AmitDiwan has Published 10744 Articles

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

AmitDiwan

AmitDiwan

Updated on 06-Dec-2019 08:10:40

113 Views

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

AmitDiwan

Updated on 06-Dec-2019 08:07:13

138 Views

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

AmitDiwan

Updated on 06-Dec-2019 08:02:33

102 Views

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 set1 = new SortedSet();       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

AmitDiwan

Updated on 06-Dec-2019 07:58:44

269 Views

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

AmitDiwan

Updated on 06-Dec-2019 07:54:46

278 Views

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

AmitDiwan

Updated on 06-Dec-2019 07:51:15

198 Views

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

AmitDiwan

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

85 Views

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

AmitDiwan

Updated on 06-Dec-2019 07:42:28

214 Views

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

AmitDiwan

Updated on 06-Dec-2019 07:39:34

145 Views

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

Gets or sets the value of the bit at a specific position in the BitArray in C#

AmitDiwan

AmitDiwan

Updated on 06-Dec-2019 07:36:21

125 Views

To get or set the value of the bit at a specific position in 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(2);       BitArray arr2 = new ... Read More

Advertisements