AmitDiwan has Published 10740 Articles

Check if an element is in the Collection in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 06:39:03

261 Views

To check if an element is in the Collection, the code is as follows −Example Live Demousing System; using System.Collections.ObjectModel; public class Demo {    public static void Main(){       Collection col = new Collection();       col.Add(10);       col.Add(20);       col.Add(30);     ... Read More

Check if an array object is equal to another array object in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 06:35:35

308 Views

To check if an array object is equal to another array object, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       String[] strArr1 = new String[3] { "John", "Jacob", "Tim"};       String[] strArr2 = new String[3] { ... Read More

Check if a HashSet is a proper subset of the specified collection in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 06:31:17

165 Views

To check if a HashSet is a proper subset of the specified collection, try the following code −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){       HashSet set1 = new HashSet();       set1.Add(70);       set1.Add(100);       ... Read More

Check if a HashSet contains the specified element in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 06:20:37

823 Views

To check if a HashSet contains the specified element, the 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);     ... Read More

Check if an array is read-only or not in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 06:17:11

263 Views

To check if an array is read-only or not, try the below code −Example Live Demousing System; public class Demo {    public static void Main(){       string[] products = new string[] { };       Console.WriteLine("One or more planets begin with 'E'? = {0}",       ... Read More

Get an enumerator that iterates through the Dictionary in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 06:06:52

560 Views

To get an enumerator that iterates through the Dictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Generic; public class Demo {    public static void Main(){       Dictionary dict = new Dictionary();       dict.Add(100, "Laptop");       dict.Add(150, "Desktop");     ... Read More

Get an enumerator that iterates through StringCollection in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 06:02:56

176 Views

To get an enumerator that iterates through StringCollection, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo {    public static void Main(){       StringCollection stringCol = new StringCollection();       String[] arr = new String[] { "100", "200", "300", "400", "500" }; ... Read More

Removing all nodes from LinkedList in C#

AmitDiwan

AmitDiwan

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

226 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

112 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

169 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

Advertisements