AmitDiwan has Published 10740 Articles

Copying the Hashtable elements to an Array Instance in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 11:23:32

249 Views

To copy the Hashtable elements to an Array Instance, the code is as follows−Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       Hashtable hash = new Hashtable();       hash.Add("1", "AB");       hash.Add("2", "CD");       hash.Add("3", "EF"); ... Read More

How to get a subset in a SortedSet in C#?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 11:21:06

181 Views

To get a subset in a SortedSet, 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"); ... Read More

How to create a Stack in C#?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 11:17:37

149 Views

To create a Stack, 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(150);       stack.Push(175);       stack.Push(200);       ... Read More

Copying the entire ArrayList to 1-D Array starting at the specified index in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 11:14:33

110 Views

To copy the entire ArrayList to a 1-D array starting at the specified index, 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("PQ");       list.Add("RS");   ... Read More

Copying the elements of ArrayList to a new array in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 11:08:53

176 Views

To copy the elements of ArrayList to a new array, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       ArrayList list = new ArrayList(10);       list.Add("A");       list.Add("B");       list.Add("C");   ... Read More

How to create a SortedList in C#?

AmitDiwan

AmitDiwan

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

151 Views

To create a 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");       sortedList.Add("C", "3");       ... Read More

How to create a shallow copy of the BitArray in C#?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 11:00:20

169 Views

To create a shallow copy of the BitArray, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       BitArray arr1 = new BitArray(5);       arr1[0] = false;       arr1[1] = true;       ... Read More

How to copy the entire ArrayList to a one-dimensional Array in C# ?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 10:56:17

236 Views

To copy the entire ArrayList to a one-dimensional array, 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("AB");       list.Add("BC");       list.Add("CD");     ... Read More

How to copy a String into another String in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 10:52:48

516 Views

To copy a String into another String, the code is as follows −Example Live Demousing System; public class Demo {    static public void Main(){       string str1 = "Kevin";       string str2 = String.Copy(str1);       Console.WriteLine("String1 = "+str1);       Console.WriteLine("String2 = "+str2); ... Read More

How to check whether a List contains a specified element in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 10:48:25

644 Views

To check whether a List contains a specified element, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(String[] args){       List list1 = new List();       list1.Add("One");       list1.Add("Two");       list1.Add("Three");   ... Read More

Advertisements