找到 34423 篇文章 适用于编程

C# 中的 BitConverter 类

AmitDiwan
更新于 2019-12-04 05:13:35

1K+ 次浏览

BitConverter 类将基本数据类型转换为字节数组,并将字节数组转换为基本数据类型。以下是方法 -方法描述DoubleToInt64Bits(Double)将指定的双精度浮点数转换为 64 位有符号整数。GetBytes(Boolean)将指定的布尔值作为字节数组返回。GetBytes(Char)将指定的 Unicode 字符值作为字节数组返回。GetBytes(Double)将指定的双精度浮点数作为字节数组返回。GetBytes(Int16)将指定的 16 位有符号整数值作为字节数组返回。GetBytes(Int32)将指定的 32 位有符号整数值作为字节数组返回。Int64BitsToDouble(Int64)将指定的 64 位有符号整数重新解释为双精度浮点数。ToBoolean(Byte[], Int32)返回转换后的布尔值 ... 阅读更多

C# Join() 方法

AmitDiwan
更新于 2019-12-03 13:30:20

15K+ 次浏览

C# 中的 Join() 方法用于使用指定的分割符连接字符串数组的所有元素。语法语法如下 -public static string Join (string separator, string[] val);上面,separator 是包含在字符串中的分隔符。val 参数是包含要连接的元素的数组。示例现在让我们来看一个示例 - 实时演示using System; public class Demo {    public static void Main(string[] args) {       string[] strArr = {"One", "Two", "Three", "Four" };       Console.WriteLine("字符串数组...");       foreach(string s in strArr) {     ... 阅读更多

C# String CopyTo() 方法

AmitDiwan
更新于 2020-04-30 08:13:37

1K+ 次浏览

C# 中的 CopyTo() 方法用于将此实例中指定位置的指定数量的字符复制到 Unicode 字符数组的指定位置。语法public void CopyTo (int srcIndex, char[] dest, int desIndex, int count);上面,srcIndex - 此实例中要复制的第一个字符的索引。dest - 要将此实例中的字符复制到的 Unicode 字符数组。destIndex - 复制操作开始的目的地索引。Count - 要复制到目的地的此实例中的字符数。示例现在让我们来看一个示例 - 实时演示using System; public class Demo { ... 阅读更多

C# 中的 Queue.Contains() 方法

AmitDiwan
更新于 2019-12-03 13:19:23

174 次浏览

C# 中的 Queue.Contains() 方法用于确定 Queue 中是否包含某个元素。语法语法如下 -public virtual bool Contains (object ob);上面,参数 ob 是要定位在 Queue 中的对象。示例现在让我们来看一个示例 - 实时演示using System; using System.Collections.Generic; public class Demo {    public static void Main() {       Queue queue = new Queue();       queue.Enqueue("Gary");       queue.Enqueue("Jack");       queue.Enqueue("Ryan");       queue.Enqueue("Kevin");       queue.Enqueue("Mark");       queue.Enqueue("Jack");       queue.Enqueue("Ryan");       queue.Enqueue("Kevin");       Console.Write("计数 ... 阅读更多

C# ToCharArray() 方法

AmitDiwan
更新于 2019-12-03 13:14:11

498 次浏览

C# 中的 ToCharArray() 方法用于将此实例中的字符复制到 Unicode 字符数组。语法语法如下 -public char[] ToCharArray (); public char[] ToCharArray (int begnIndex, int len);上面,begnIndex 是此实例中子字符串的起始位置。len 是此实例中子字符串的长度。示例现在让我们来看一个示例 - 实时演示using System; public class Demo {    public static void Main(String[] args) {       string str1 = "Notebook";       string str2 = "Ultrabook";       char[] arr1 = str1.ToCharArray();       char[] ... 阅读更多

C# 中的 StringBuilder.CopyTo() 方法

AmitDiwan
更新于 2019-12-03 13:10:16

233 次浏览

C# 中的 StringBuilder.CopyTo() 方法用于将此实例的指定段中的字符复制到目标 Char 数组的指定段。语法语法如下 -public void CopyTo (int sourceIndex, char[] dest, int destIndex, int count);上面,参数 sourceIndex 是此实例中将从中复制字符的起始位置。dest 是将复制字符到的数组,而 destIndex 是目标中复制字符的起始位置。count 参数是要复制的字符数。示例现在让我们来看一个示例 - 实时演示 ... 阅读更多

C# 中的 Queue.Clone() 方法

AmitDiwan
更新于 2019-12-03 13:06:32

200 次浏览

C# 中的 Queue.Clone() 方法用于创建 Queue 的浅拷贝。语法语法如下 -public virtual object Clone ();示例现在让我们来看一个示例 - 实时演示using System; using System.Collections; public class Demo {    public static void Main(string[] args) {       Queue queue = new Queue();       queue.Enqueue("One");       queue.Enqueue("Two");       queue.Enqueue("Three");       queue.Enqueue("Four");       queue.Enqueue("Five");       queue.Enqueue("Six");       queue.Enqueue("Seven");       queue.Enqueue("Eight");       Console.WriteLine("队列...");       foreach(string str in queue) {       ... 阅读更多

C# 中的 Queue.Clear 方法

AmitDiwan
更新于 2019-12-03 13:01:58

123 次浏览

C# 中的 Queue.Clear() 方法用于清除 Queue 中的所有对象。语法语法如下 -public virtual void Clear ();示例现在让我们来看一个示例 - 实时演示using System; using System.Collections.Generic; public class Demo {    public static void Main() {       Queue queue = new Queue();       queue.Enqueue(100);       queue.Enqueue(200);       queue.Enqueue(300);       queue.Enqueue(400);       queue.Enqueue(500);       queue.Enqueue(600);       queue.Enqueue(700);       queue.Enqueue(800);       queue.Enqueue(900);       queue.Enqueue(1000);       Console.WriteLine("队列...");       foreach(int i in ... 阅读更多

C# 中的 Double.IsPositiveInfinity() 方法

AmitDiwan
更新于 2019-12-03 12:57:10

151 次浏览

C# 中的 Double.IsPositiveInfinity() 方法用于返回一个值,指示指定的数字是否计算为正无穷大。语法语法如下:public static bool IsPositiveInfinity (double val);上面,val 是一个双精度浮点数。示例现在让我们来看一个示例:实时演示using System; public class Demo {    public static void Main() {       double d = 1.0/0.0;       Console.WriteLine("Double Value = "+d);       Console.WriteLine("HashCode of Double Value = "+d.GetHashCode());       TypeCode type = d.GetTypeCode();       Console.WriteLine("TypeCode of Double Value = "+type);       Console.WriteLine("Positive Infinity? = "+Double.IsInfinity(d)); ... 阅读更多

C# ToLower() 方法

AmitDiwan
更新于 2019年12月3日 12:52:59

274 次查看

C# 中的 ToLower() 方法用于返回此字符串转换为小写的副本。语法语法如下:public string ToLower ();示例现在让我们来看一个示例:实时演示using System; public class Demo {    public static void Main(String[] args) {       string str1 = "WELCOME!";       string str2 = "Thisisit!";       char[] arr1 = str1.ToCharArray(3, 2);       char[] arr2 = str2.ToCharArray(2, 2);       Console.WriteLine("String1 = "+str1);       Console.WriteLine("String1 ToLower = "+str1.ToLower());       Console.WriteLine("String1 Substring from index4 = " + str1.Substring(4, 4));   ... 阅读更多

广告

© . All rights reserved.