AmitDiwan has Published 10744 Articles

Removing all nodes from LinkedList in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:58:13

203 Views

To remove all nodes from LinkedList, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       int [] num = {10, 20, 30, 40, 50};       LinkedList list = new LinkedList(num);       Console.WriteLine("LinkedList ... Read More

Removing all entries from the StringDictionary in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:52:40

100 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", ... Read More

Check if an Array has fixed size or not in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:48:26

138 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...");       ... Read More

Check if an array contains the elements that match the specified conditions in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:44:00

457 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" };       ... Read More

Check if a value is in LinkedList in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:23:50

108 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); ... Read More

Check if a HashSet and a specified collection share common element in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:20:15

126 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);   ... Read More

BitConverter Class in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:13:35

1K+ 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 ... Read More

Queue.Contains() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 13:19:23

208 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 { ... Read More

StringBuilder.CopyTo() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 13:10:16

316 Views

The StringBuilder.CopyTo() method in C# is used to copy the characters from a specified segment of this instance to a specified segment of a destination Char array.SyntaxThe syntax is as follows -public void CopyTo (int sourceIndex, char[] dest, int destIndex, int count);Above, the parameter sourceIndex is the starting position in ... Read More

Queue.Clone() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 13:06:32

300 Views

The Queue.Clone() method in C# is used to create a shallow copy of the Queue.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(string[] args) {       Queue queue ... Read More

Advertisements