找到 34423 篇文章 适用于编程
203 次浏览
C# 中的 Stack.Clone() 方法用于创建 Stack 的浅拷贝。语法语法如下:public virtual object Clone();示例让我们来看一个示例:实时演示using System; using System.Collections; public class Demo { public static void Main(){ Stack stack = new Stack(); stack.Push(150); stack.Push(300); stack.Push(500); stack.Push(750); stack.Push(1000); stack.Push(1250); stack.Push(1500); stack.Push(2000); stack.Push(2500); Console.WriteLine("栈元素..."); foreach(int val in stack){ ... 阅读更多
121 次浏览
C# 中的 Queue.Equals() 方法用于检查一个队列对象是否等于另一个队列对象。语法语法如下:public virtual bool Equals (object obj);上面,参数 obj 用于比较。示例让我们来看一个示例:实时演示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.WriteLine(queue.Equals(queue)); ... 阅读更多
328 次浏览
C# 中的 Queue.Enqueue() 方法用于将对象添加到 Queue 的末尾。语法语法如下:public virtual void Enqueue (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"); ... 阅读更多
41 次浏览
C# 中的 SortedDictionary.ContainsValue() 方法用于确定 SortedDictionary 是否包含具有指定值的元素。语法语法如下:public bool ContainsValue (TValue val);上面,值 val 是要在 SortedDictionary 中搜索的值。示例让我们来看一个示例:实时演示using System; using System.Collections; using System.Collections.Generic; public class Demo { public static void Main(){ SortedDictionary sortedDict = new SortedDictionary(); sortedDict.Add(100, "Inspiron"); sortedDict.Add(200, "Alienware"); sortedDict.Add(300, "Projectors"); sortedDict.Add(400, "XPS"); Console.WriteLine("SortedDictionary 键值对..."); IDictionaryEnumerator demoEnum ... 阅读更多
2K+ 次浏览
C# 中的 TimeSpan.Compare() 方法用于比较两个 TimeSpan 值,并返回一个整数,指示第一个值是否短于、等于或长于第二个值。返回值为 -1,如果 span1 短于 span2,0 如果 span1=span2,而 1 如果 span1 长于 span2。语法语法如下:public static int Compare (TimeSpan span1, TimeSpan span2);上面,参数 span1 是要比较的第一个时间间隔,而 span2 是要比较的第二个时间间隔。示例让我们来看一个示例:实时演示using System; public class Demo { public static void ... 阅读更多
904 次浏览
C# 中的 TimeSpan.Add() 方法用于返回一个新的 TimeSpan 对象,其值为指定的 TimeSpan 对象与此实例的总和。语法语法如下:public TimeSpan Add (TimeSpan span);上面,参数 span 是要添加的时间间隔。示例让我们来看一个示例:实时演示using System; public class Demo { public static void Main(){ TimeSpan span1 = new TimeSpan(2, 17, 20, 30); TimeSpan span2 = new TimeSpan(3, 18, 25, 25); TimeSpan span3 = new TimeSpan(-8, 30, 0); TimeSpan res1 = span1.Add(span2); ... 阅读更多
69 次浏览
C# 中的 Double.IsInfinity() 方法用于返回一个值,指示指定数字是否计算为负无穷大或正无穷大。语法语法如下:public static bool IsInfinity (double d);上面,值 d 是一个双精度浮点数。示例让我们来看一个示例:实时演示using System; public class Demo { public static void Main(){ double d = 5.5; Console.WriteLine("双精度值 = "+d); Console.WriteLine("双精度值的哈希码 = "+d.GetHashCode()); TypeCode type = d.GetTypeCode(); Console.WriteLine("双精度值的类型代码 = "+type); Console.WriteLine("正 ... 阅读更多
59 次浏览
C# 中的 SortedDictionary.Clear() 方法用于从 SortedDictionary 中删除所有元素。语法语法如下:public void Clear ();示例让我们来看一个示例:实时演示using System; using System.Collections; using System.Collections.Generic; public class Demo { public static void Main(){ SortedDictionary sortedDict = new SortedDictionary(); sortedDict.Add(100, "Mobile"); sortedDict.Add(200, "Laptop"); sortedDict.Add(300, "Desktop"); sortedDict.Add(400, "Speakers"); sortedDict.Add(500, "Headphone"); sortedDict.Add(600, "Earphone"); Console.WriteLine("SortedDictionary 键值对..."); IDictionaryEnumerator demoEnum = sortedDict.GetEnumerator(); while (demoEnum.MoveNext()) ... 阅读更多
114 次浏览
C# 中的 SortedDictionary.Add() 方法用于将具有指定键和值的元素添加到 SortedDictionary 中。语法语法如下:public void Add (TKey key, TValue val);上面,值 key 是要添加的元素的键,而 val 是要添加的元素的值。示例让我们来看一个示例:实时演示using System; using System.Collections; using System.Collections.Generic; public class Demo { public static void Main(){ SortedDictionary sortedDict = new SortedDictionary(); sortedDict.Add(100, "Mobile"); sortedDict.Add(200, "Laptop"); sortedDict.Add(300, "Desktop"); sortedDict.Add(400, ... 阅读更多
952 次浏览
C# 中的 TimeSpan.Subtract() 方法用于返回一个新的 TimeSpan 对象,其值为指定的 TimeSpan 对象与此实例的差值。语法语法如下:public TimeSpan Subtract (TimeSpan span);上面,参数 span 是要减去的时间间隔。示例让我们来看一个示例:实时演示using System; public class Demo { public static void Main(){ TimeSpan span1 = TimeSpan.FromTicks(1); TimeSpan span2 = new TimeSpan(1); TimeSpan span3 = TimeSpan.FromHours(1); TimeSpan span4 = TimeSpan.FromMilliseconds(1); TimeSpan span5 = TimeSpan.FromMinutes(1); ... 阅读更多
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP