- 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 SortedDictionary.Clear() method in C# is used to remove all elements from the SortedDictionary.SyntaxThe syntax is as follows −public void Clear ();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, "Mobile"); sortedDict.Add(200, "Laptop"); sortedDict.Add(300, "Desktop"); sortedDict.Add(400, "Speakers"); sortedDict.Add(500, "Headphone"); sortedDict.Add(600, "Earphone"); Console.WriteLine("SortedDictionary key-value pairs..."); IDictionaryEnumerator demoEnum = sortedDict.GetEnumerator(); while (demoEnum.MoveNext()) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
89 Views
The SortedDictionary.Add() method in C# is used to add an element with the specified key and value into the SortedDictionary.SyntaxThe syntax is as follows −public void Add (TKey key, TValue val);Above, the value key is the key of the element to add, whereas val is the value of the element to add.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, "Mobile"); sortedDict.Add(200, "Laptop"); sortedDict.Add(300, "Desktop"); sortedDict.Add(400, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
912 Views
The TimeSpan.Subtract() method in C# is used to return a new TimeSpan object whose value is the difference between the specified TimeSpan object and this instance.SyntaxThe syntax is as follows −public TimeSpan Subtract (TimeSpan span);Above, the parameter span is the time interval to be subtracted.ExampleLet us now see an example − Live Demousing 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); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
881 Views
The TimeSpan.FromHours() method in C# is used to return a TimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond.SyntaxThe syntax is as follows −public static TimeSpan FromHours (double val);Above, the value val is a number of hours accurate to the nearest millisecond.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main(){ TimeSpan span1 = TimeSpan.FromDays(0.000323456); TimeSpan span2 = new TimeSpan(-2, 05, 10); TimeSpan span3 = TimeSpan.FromHours(5); Console.WriteLine("TimeSpan1 = "+span1); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
62 Views
The Stack.GetEnumerator() method in C# is used to return an IEnumerator for the Stack.SyntaxThe syntax is as follows −public virtual System.Collections.IEnumerator GetEnumerator ();ExampleLet us now see an example − Live Demousing System; using System.Collections; public class Demo { public static void Main(){ Stack stack1 = new Stack(); stack1.Push(150); stack1.Push(300); stack1.Push(500); stack1.Push(750); stack1.Push(1000); Console.WriteLine("Stack1 elements..."); foreach(int val in stack1){ Console.WriteLine(val); } Stack stack2 = new Stack(); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
233 Views
The Stack.Equals() method in C# is used to check whether a Stack class object is equal to another object or not.SyntaxThe syntax is as follows −public virtual bool Equals (object ob);Above, the parameter ob is the object compared with another.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); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
565 Views
The Double.IsNaN() method in C# is used to return a value that indicates whether the specified value is not a number (NaN).SyntaxThe syntax is as follows −public static bool IsNaN (double val);Above, val is the double-precision floating-point number.ExampleLet us now see an example − Live Demousing 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? = ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
521 Views
The TimeSpan.FromDays() method in C# is used to return a TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond.SyntaxThe syntax is as follows −public static TimeSpan FromDays (double val);Above, the parameter val is the number of days, accurate to the nearest millisecond.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main(){ TimeSpan span1 = new TimeSpan(5, 25, 0); TimeSpan span2 = new TimeSpan(1, 10, 0); TimeSpan span3 = TimeSpan.FromDays(43.999999); Console.WriteLine("TimeSpan1 = "+span1); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
194 Views
The BitConverter.ToUInt64() method in C# is used to return a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array.Syntaxpublic static ulong ToUInt64 (byte[] val, int begnIndex);ExampleAbove, val is the byte array, whereas begnIndex is the beginning position within val. Live Demousing System; public class Demo { public static void Main() { byte[] arr = { 0, 0, 1, 3, 5, 7, 9, 11, 15 }; int count = arr.Length; Console.Write("Byte Array... "); for (int i = 0; i < count; i++) { ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
190 Views
The BitConverter.ToUInt32() method in C# is used to return a 32-bit unsigned integer converted from four bytes at a specified position in a byte array.Syntaxpublic static uint ToUInt32 (byte[] val, int begnIndex);Above, val is the byte array, whereas begnIndex is the starting position withing val.Example Live Demousing System; public class Demo { public static void Main() { byte[] arr = { 0, 3, 5, 10, 15, 2}; int count = arr.Length; Console.Write("Byte Array... "); for (int i = 0; i < count; i++) { ... Read More