- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2628 Articles for Csharp
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
54 Views
The Queue.ToArray() method in C# copies the Queue elements to a new array.SyntaxThe syntax is as follows −public virtual object[] ToArray ();ExampleLet us now see an example − Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(){ Queue queue = new Queue(); queue.Enqueue(1); queue.Enqueue(2); queue.Enqueue(3); queue.Enqueue(4); queue.Enqueue(5); Console.WriteLine("Queue..."); foreach(int i in queue){ Console.WriteLine(i); } int[] intArr = queue.ToArray(); Console.WriteLine("Convert ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
74 Views
The Stack.CopyTo() method in C# is used to copy the Stack to an existing one-dimensional Array, beginning at the specified array index.SyntaxThe syntax is as follows −public virtual void CopyTo (Array arr, int index);Above, the parameter arr is the one-dimensional Array that is the destination of the elements copied from Stack, whereas the index is the index at which the copy initiates.ExampleLet us now see an example − Live Demousing System; using System.Collections; public class Demo { public static void Main(){ Stack stack = new Stack(); stack.Push(150); stack.Push(300); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
134 Views
The Queue.Synchronized() method in C# is used to return a new Queue that wraps the original queue and is thread-safe.SyntaxThe syntax is as follows −public static System.Collections.Queue Synchronized (System.Collections.Queue queue);Above, the parameter queue is the queue to synchronize.ExampleLet us now see an example − Live Demousing System; using System.Collections; public class Demo { public static void Main(){ Queue queue = new Queue(); queue.Enqueue("AB"); queue.Enqueue("BC"); queue.Enqueue("CD"); queue.Enqueue("DE"); queue.Enqueue("EF"); queue.Enqueue("FG"); queue.Enqueue("GH"); queue.Enqueue("HI"); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
164 Views
The Stack.Clone() method in C# is used to create a shallow copy of the Stack.SyntaxThe syntax is as follows −public virtual object Clone ();ExampleLet us now see an example − Live Demousing 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("Stack elements..."); foreach(int val in stack){ ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
109 Views
The Queue.Equals() method in C# is used to check if a queue object is equal to another queue object.SyntaxThe syntax is as follows −public virtual bool Equals (object obj);Above, the parameter obj is for comparison.ExampleLet us now see an example − Live Demousing 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)); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
273 Views
The Queue.Enqueue() method in C# is used to add an object to the end of the Queue.SyntaxThe syntax is as follows −public virtual void Enqueue (object ob);Above, the parameter ob is the object to add to the Queue.ExampleLet us now see an example − Live Demousing 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"); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
36 Views
The SortedDictionary.ContainsValue() method in C# is used to determine whether the SortedDictionary contains an element with the specified value.SyntaxThe syntax is as follows −public bool ContainsValue (TValue val);Above, the value val is the value to be searched in the SortedDictionary.ExampleLet us now see an example − Live Demousing 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 key-value pairs..."); IDictionaryEnumerator demoEnum ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
The TimeSpan.Compare() method in C# is used to compare two TimeSpan values and returns an integer that indicates whether the first value is shorter than, equal to, or longer than the second value.The return value is -1 if span1 is shorter than span2, 0 if span1=span2, whereas 1 if span1 is longer than span2.SyntaxThe syntax is as follows −public static int Compare (TimeSpan span1, TimeSpan span2);Above, the parameter span1 is the 1st time interval to compare, whereas span2 is the 2nd interval to compare.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
867 Views
The TimeSpan.Add() method in C# is used to return a new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance.SyntaxThe syntax is as follows −public TimeSpan Add (TimeSpan span);Above, the parameter span is the time interval to add.ExampleLet us now see an example − Live Demousing 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); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
58 Views
The Double.IsInfinity() method in C# is used to return a value indicating whether the specified number evaluates to negative or positive infinity.SyntaxThe syntax is as follows −public static bool IsInfinity (double d);Above, the value d is a double-precision floating-point number.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main(){ double d = 5.5; 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 ... Read More