AmitDiwan has Published 10740 Articles

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

AmitDiwan

AmitDiwan

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

300 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

302 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

226 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

109 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

248 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

168 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

153 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

How to get First Element of the Tuple in C#?

AmitDiwan

AmitDiwan

Updated on 06-Dec-2019 07:22:50

913 Views

To get the first element of the Tuple, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(String[] args){       var tuple1 = Tuple.Create(75, 200, 500, 700, 100, 1200, 1500);       var tuple2 = Tuple.Create(75, 200, 500, 700, 100, ... Read More

Check if two ListDictionary objects are equal in C#

AmitDiwan

AmitDiwan

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

179 Views

To check if two ListDictionary 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(){       ListDictionary dict1 = new ListDictionary();       dict1.Add("A", "Books");       dict1.Add("B", "Electronics");       ... Read More

Check if two List objects are equal in C#

AmitDiwan

AmitDiwan

Updated on 06-Dec-2019 07:09:29

431 Views

To check if two List 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){       List list1 = new List();       list1.Add("One");       list1.Add("Two");       list1.Add("Three");     ... Read More

Advertisements