AmitDiwan has Published 10744 Articles

Check if two StringBuilder objects are Equal in C#

AmitDiwan

AmitDiwan

Updated on 05-Dec-2019 06:51:17

148 Views

To check if two StringBuilder objects are equal, the code is as follows −Example Live Demousing System; using System.Text; public class Demo {    public static void Main(String[] args){       StringBuilder strBuilder1 = new StringBuilder("Tim");       StringBuilder strBuilder2 = new StringBuilder("Tom");       StringBuilder strBuilder3 = ... Read More

Check if two String objects have the same value in C#

AmitDiwan

AmitDiwan

Updated on 05-Dec-2019 06:47:41

169 Views

To check if two String objects have the same value, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(String[] args){       string str1 = "John";       string str2 = "John";       Console.WriteLine("String 1 = "+str1);   ... Read More

Creating a read-only wrapper for the ArrayList in C#

AmitDiwan

AmitDiwan

Updated on 05-Dec-2019 06:38:28

185 Views

To create a read-only wrapper for ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       ArrayList list = new ArrayList();       list.Add("One");       list.Add("Two");       list.Add("Three");       list.Add("Four"); ... Read More

Get an enumerator that iterates through the SortedList in C#

AmitDiwan

AmitDiwan

Updated on 05-Dec-2019 06:34:48

443 Views

To get an enumerator that iterates through the SortedList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(String[] args){       SortedList sortedList = new SortedList();       sortedList.Add("A", "1");       sortedList.Add("B", "2");       ... Read More

Creating a HybridDictionary with specified initial size in C#

AmitDiwan

AmitDiwan

Updated on 05-Dec-2019 06:29:24

94 Views

To create a HybridDictionary with specified initial size, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       HybridDictionary dict = new HybridDictionary(5);       dict.Add("A", "AB");       dict.Add("B", "BC");       ... Read More

Creating a Case-Sensitive HybridDictionary with specified initial size in C#

AmitDiwan

AmitDiwan

Updated on 05-Dec-2019 06:25:29

113 Views

To create a case-sensitive HybridDictionary with specified initial size, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       HybridDictionary myDict = new HybridDictionary(5, false);       myDict.Add("A", "AB");       myDict.Add("B", "BC");   ... Read More

Create HashSet from another collection in C#

AmitDiwan

AmitDiwan

Updated on 05-Dec-2019 06:22:40

167 Views

To create HashSet from another 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(100);       set1.Add(200);       set1.Add(300);       Console.WriteLine("HashSet created from ... Read More

Create a Stack from a collection in C#

AmitDiwan

AmitDiwan

Updated on 05-Dec-2019 06:18:09

125 Views

To create a Stack from a collection, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){       Stack stack = new Stack();       stack.Push(100);       stack.Push(200);       stack.Push(300);       stack.Push(400); ... Read More

Check if two LinkedList objects are equal in C#

AmitDiwan

AmitDiwan

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

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

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

AmitDiwan

AmitDiwan

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

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

Advertisements