找到34423篇关于编程的文章
203次浏览
C#中的Stack.Clone()方法用于创建堆栈的浅拷贝。语法语法如下: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()方法用于将对象添加到队列的末尾。语法语法如下:public virtual void Enqueue (object ob);上述参数ob是要添加到队列中的对象。示例让我们来看一个例子: 在线演示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值,并返回一个整数,该整数指示第一个值是否短于、等于或长于第二个值。如果span1短于span2,则返回值为-1;如果span1=span2,则返回值为0;如果span1长于span2,则返回值为1。语法语法如下: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); ... 阅读更多
数据结构
网络
关系数据库管理系统 (RDBMS)
操作系统
Java
iOS
HTML
CSS
Android
Python
C语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP