Found 26504 Articles for Server Side Programming

Check if two LinkedList objects are equal in C#

AmitDiwan
Updated on 05-Dec-2019 06:12:55

131 Views

To check if two LinkedList objects are equal, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(String[] args){       LinkedList list1 = new LinkedList();       list1.AddLast("One");       list1.AddLast("Two");       list1.AddLast("Three");       list1.AddLast("Four");       list1.AddLast("Five");       Console.WriteLine("Elements in LinkedList1...");       foreach (string res in list1){          Console.WriteLine(res);       }       LinkedList list2 = new LinkedList();       list2.AddLast("India");       list2.AddLast("US");       list2.AddLast("UK");   ... Read More

Remove all elements of a List that match the conditions defined by the predicate in C#

AmitDiwan
Updated on 05-Dec-2019 06:06:21

900 Views

To remove all elements from a list that match the conditions defined by the predicate, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    private static bool demo(int i){       return (i == 500);    }    public static void Main(String[] args){       List list = new List();       list.Add(100);       list.Add(500);       list.Add(300);       list.Add(400);       list.Add(500);       list.Add(600);       list.Add(500);       Console.WriteLine("List elements...");       foreach (int i in list){   ... Read More

Check if a SortedSet is a superset of the specified collection in C#

AmitDiwan
Updated on 05-Dec-2019 06:02:08

108 Views

To check if a SortedSet is a superset of the specified collection, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){       SortedSet set1 = new SortedSet();       set1.Add("CD");       set1.Add("CD");       set1.Add("CD");       set1.Add("CD");       Console.WriteLine("Elements in SortedSet1...");       foreach (string res in set1){          Console.WriteLine(res);       }       SortedSet set2 = new SortedSet();       set2.Add("BC");       set2.Add("CD");       set2.Add("DE");     ... Read More

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

AmitDiwan
Updated on 05-Dec-2019 05:58:33

123 Views

To check if a HashSet is a superset of the specified collection, 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("AB");       set1.Add("CD");       set1.Add("EF");       set1.Add("AB");       set1.Add("IJ");       set1.Add("KL");       set1.Add("EF");       set1.Add("OP");       Console.WriteLine("Elements in HashSet1");       foreach(string val in set1){          Console.WriteLine(val);       }       HashSet set2 = new ... Read More

Check if two HybridDictionary objects are equal in C#

AmitDiwan
Updated on 05-Dec-2019 05:54:01

147 Views

To check if two HybridDictionary objects are equal, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       HybridDictionary dict1 = new HybridDictionary();       dict1.Add("A", "Books");       dict1.Add("B", "Electronics");       dict1.Add("C", "Smart Wearables");       dict1.Add("D", "Pet Supplies");       dict1.Add("E", "Clothing");       dict1.Add("F", "Footwear");       Console.WriteLine("HybridDictionary1 elements...");       foreach(DictionaryEntry d in dict1){          Console.WriteLine(d.Key + " " + d.Value);       }       HybridDictionary dict2 ... Read More

Check if two HashSet objects are equal in C#

AmitDiwan
Updated on 05-Dec-2019 05:47:38

357 Views

To check if two HashSet objects are equal, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(String[] args) {       HashSet set1 = new HashSet();       set1.Add("A");       set1.Add("B");       set1.Add("C");       set1.Add("D");       set1.Add("E");       set1.Add("F");       set1.Add("G");       set1.Add("H");       Console.WriteLine("Elements in HashSet1...");       foreach (string res in set1) {          Console.WriteLine(res);       }       HashSet set2 = new ... Read More

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

AmitDiwan
Updated on 05-Dec-2019 05:37:16

100 Views

To check if a SortedSet is a subset of the specified collection, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){       SortedSet set1 = new SortedSet();       set1.Add("AB");       set1.Add("BC");       set1.Add("CD");       set1.Add("EF");       Console.WriteLine("Elements in SortedSet1...");       foreach (string res in set1){          Console.WriteLine(res);       }       SortedSet set2 = new SortedSet();       set2.Add("BC");       set2.Add("CD");       set2.Add("DE");     ... Read More

Check if two ArrayList objects are equal in C#

AmitDiwan
Updated on 05-Dec-2019 05:34:17

354 Views

To check if two ArrayList objects are equal, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(String[] args){       ArrayList list1 = new ArrayList();       list1.Add("A");       list1.Add("B");       list1.Add("C");       list1.Add("D");       list1.Add("E");       list1.Add("F");       list1.Add("G");       list1.Add("H");       list1.Add("I");       Console.WriteLine("Elements in ArrayList1...");       foreach (string res in list1){          Console.WriteLine(res);       }       ArrayList list2 ... Read More

Get a collection of values in the StringDictionary in C#

AmitDiwan
Updated on 05-Dec-2019 05:23:46

131 Views

To get a collection of values in 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("S", "Home Appliances");       strDict1.Add("T", "Smart Wearable Tech");       strDict1.Add("U", "Electronics");       strDict1.Add("V", "Toys");       strDict1.Add("W", "Books");       strDict1.Add("X", "Accessories");       Console.WriteLine("StringDictionary elements...");       foreach(DictionaryEntry d in strDict1){          Console.WriteLine(d.Key + " " + d.Value);       }       ... Read More

Check if a SortedList object has a fixed size in C#

AmitDiwan
Updated on 05-Dec-2019 05:20:13

129 Views

To check if a SortedList object has a fixed size, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       SortedList list = new SortedList();       list.Add("1", "One");       list.Add("2", "Two");       list.Add("3", "Three");       list.Add("4", "Four");       list.Add("5", "Five");       list.Add("6", "Six");       list.Add("7", "Seven");       list.Add("8", "Eight");       Console.WriteLine("Key and Value of SortedList....");       foreach(DictionaryEntry k in list )       Console.WriteLine("Key: {0}, Value: {1}", ... Read More

Advertisements