- 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)
58 Views
To remove all entries from the StringDictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main(){ StringDictionary strDict1 = new StringDictionary(); strDict1.Add("A", "John"); strDict1.Add("B", "Andy"); strDict1.Add("C", "Tim"); strDict1.Add("D", "Ryan"); strDict1.Add("E", "Kevin"); strDict1.Add("F", "Katie"); strDict1.Add("G", "Brad"); Console.WriteLine("StringDictionary1 elements..."); foreach(DictionaryEntry d in strDict1){ Console.WriteLine(d.Key + " " + d.Value); } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
86 Views
To check if an array has fixed size or not, try the below code −Example Live Demousing System; public class Demo { public static void Main(){ string[] products = new string[] { "Electronics", "Accessories", "Clothing", "Toys", "Clothing", "Furniture" }; Console.WriteLine("Products list..."); foreach(string s in products){ Console.WriteLine(s); } Console.WriteLine("Is the products Accessories in the array? = {0}", Array.Exists(products, ele => ele == "Accessories")); Console.WriteLine("Is the products Stationery in the array? = {0}", ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
354 Views
To check if an array contains the elements that match the specific conditions, we can use the StartsWith() method in C# −Example Live Demousing System; public class Demo { public static void Main(){ string[] products = { "Electronics", "Accessories", "Clothing", "Toys", "Clothing", "Furniture" }; Console.WriteLine("Products list..."); foreach(string s in products){ Console.WriteLine(s); } Console.WriteLine("One or more products begin with the letter 'C'? = {0}", Array.Exists(products, ele => ele.StartsWith("C"))); Console.WriteLine("One or more planets begin with 'D'? = ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
71 Views
To check if a value is in LinkedList, try the below code −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(){ LinkedList linkedList = new LinkedList(); linkedList.AddLast(25); linkedList.AddLast(50); linkedList.AddLast(100); linkedList.AddLast(200); linkedList.AddLast(400); linkedList.AddLast(500); linkedList.AddLast(550); linkedList.AddLast(600); linkedList.AddLast(800); linkedList.AddLast(1200); Console.WriteLine("Count of nodes = " + linkedList.Count); foreach(int val in linkedList){ Console.WriteLine(val); } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
73 Views
To check if a HashSet and a specified collection share a common element, the C# code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(){ HashSet set1 = new HashSet(); set1.Add(25); set1.Add(50); set1.Add(75); set1.Add(100); set1.Add(125); set1.Add(150); Console.WriteLine("Elements in HashSet1"); foreach(int val in set1){ Console.WriteLine(val); } HashSet set2 = new HashSet(); set2.Add(30); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
986 Views
The BitConverter class converts base data types to an array of bytes, and an array of bytes to base data types.Following are the methods −MethodDescriptionDoubleToInt64Bits(Double)Converts the specified double-precision floating-point number to a 64-bit signed integer.GetBytes(Boolean)Returns the specified Boolean value as a byte array.GetBytes(Char)Returns the specified Unicode character value as an array of bytes.GetBytes(Double)Returns the specified double-precision floating-point value as an array of bytes.GetBytes(Int16)Returns the specified 16-bit signed integer value as an array of bytes.GetBytes(Int32)Returns the specified 32-bit signed integer value as an array of bytes.Int64BitsToDouble(Int64)Reinterprets the specified 64-bit signed integer to a double-precision floating-point number.ToBoolean(Byte[], Int32)Returns a Boolean value converted ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
14K+ Views
The Join() method in C# is used to concatenate all the elements of a string array, using the specified separator between each element.SyntaxThe syntax is as follows -public static string Join (string separator, string[] val);Above, separator is the separator that gets included in the string. The val parameter is the array containing elements to concatenate.ExampleLet us now see an example - Live Demousing System; public class Demo { public static void Main(string[] args) { string[] strArr = {"One", "Two", "Three", "Four" }; Console.WriteLine("String Array..."); foreach(string s in strArr) { ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
The CopyTo() method in C# is used to copy a specified number of characters from a specified position in this instance to a specified position in an array of Unicode characters.Syntaxpublic void CopyTo (int srcIndex, char[] dest, int desIndex, int count);Above, srcIndex − Index of the first character in this instance to copy.dest − Array of Unicode characters to which characters in this instance are copied.destIndex − The index in destination at which the copy operation begins.Count − Number of characters in this instance to copy to destination.ExampleLet us now see an example - Live Demousing System; public class Demo { ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
156 Views
The Queue.Contains() method in C# is used to determine whether an element is in the Queue.SyntaxThe syntax is as follows -public virtual bool Contains (object ob);Above, the parameter ob is the Object to locate in 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"); Console.Write("Count ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
463 Views
The ToCharArray() method in C# is used to copy the characters in this instance to a Unicode character array.SyntaxThe syntax is as follows -public char[] ToCharArray (); public char[] ToCharArray (int begnIndex, int len);Above, begnIndex is the beginning position of a substring in this instance. The len is the length of the substring in this instance.ExampleLet us now see an example - Live Demousing System; public class Demo { public static void Main(String[] args) { string str1 = "Notebook"; string str2 = "Ultrabook"; char[] arr1 = str1.ToCharArray(); char[] ... Read More