Add key and value into StringDictionary in C#

AmitDiwan
Published on 06-Dec-2019 09:36:23
To add key and value into 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 strDict = new StringDictionary();       strDict.Add("A", "John");       strDict.Add("B", "Andy");       ... Read More

Bitwise exclusive OR operation between the elements of BitArray in C#

AmitDiwan
Published on 06-Dec-2019 08:09:13
Let us see how to implement Bitwise exclusive OR operation between elements of BitArray −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       BitArray arr1 = new BitArray(5);       BitArray arr2 = new BitArray(5);       arr1[0] = false; ... Read More

Add an object to the end of the ArrayList in C#

AmitDiwan
Published on 06-Dec-2019 08:04:37
To add an object to the end of the ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(String[] args){       ArrayList list = new ArrayList();       list.Add("Tim");       list.Add("Katie");       list.Add("Amy"); ... Read More

How to create a SortedSet in C#?

AmitDiwan
Published on 06-Dec-2019 08:00:13
To create a SortedSet, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){       SortedSet<string> set1 = new SortedSet<string>();       set1.Add("AB");       set1.Add("BC");       set1.Add("CD");       set1.Add("EF");       ... Read More

How to check current state of a thread in C#?

AmitDiwan
Published on 06-Dec-2019 07:56:27
To check the current state of a thread, the code is as follows −Example Live Demousing System; using System.Threading; public class Demo {    public static void Main(){       Thread thread = new Thread(new ThreadStart(demo1));       ThreadPool.QueueUserWorkItem(new WaitCallback(demo2));       Console.WriteLine("Current state of Thread = "+thread.ThreadState); ... Read More

How to add key/value pairs in SortedList in C#?

AmitDiwan
Published on 06-Dec-2019 07:52:57
To add key/value pairs in SortedList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(String[] args){       SortedList list = new SortedList();       list.Add("A", "Jacob");       list.Add("B", "Sam");       list.Add("C", "Tom");   ... Read More

Getting the unique identifier for the current managed thread in C#

AmitDiwan
Published on 06-Dec-2019 07:49:37
To get the unique identifier for the currently managed thread, the code is as follows −Example Live Demousing System; using System.Threading; public class Demo {    public static void Main(){       Thread thread = new Thread(new ThreadStart(demo1));       ThreadPool.QueueUserWorkItem(new WaitCallback(demo2));       Console.WriteLine("ManagedThreadId = "+thread.ManagedThreadId);   ... Read More

Getting the Type of the Tuple’s Element in C#

AmitDiwan
Published on 06-Dec-2019 07:44:52
To get the type of the Tuple’s element, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(String[] args){       var tuple1 = Tuple.Create(150, 1500, Tuple.Create(50, 100));       var tuple2 = Tuple.Create(150, 1500, Tuple.Create(100, 200));       Console.WriteLine("Is ... Read More

Getting the type of the current instance in C#

AmitDiwan
Published on 06-Dec-2019 07:41:11
To get the type of the current instance, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       string s = "Demo";       Console.WriteLine("String = " +s);       Console.WriteLine("String Type = " +s.GetType());    } }OutputThis ... Read More

Getting an enumerator for a range of elements in the ArrayList in C#

AmitDiwan
Published on 06-Dec-2019 07:37:56
To get an enumerator for a range of elements in the ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       ArrayList arrList = new ArrayList();       arrList.Add(100);       arrList.Add(200);       ... Read More
Advertisements