AmitDiwan has Published 10744 Articles

Search in a SortedList object in C#

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 09:57:40

194 Views

To search in a SortedList object, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       SortedList list = new SortedList();       list.Add("1", "One");       list.Add("2", "Two");       list.Add("3", "Three");   ... Read More

How to check whether a thread is a background thread or not in C#

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 09:53:24

228 Views

To check whether a thread is a background thread or not, 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 ... Read More

Number of elements in HashSet in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 09:45:47

232 Views

To get the number of elements in HashSet in C#, 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(25);       set1.Add(50);       set1.Add(75); ... Read More

Removing the specified node from the LinkedList in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 09:34:53

126 Views

To remove the specified node from the LinkedList, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       LinkedList list = new LinkedList();       list.AddLast(100);       list.AddLast(200);       list.AddLast(300);     ... Read More

Set the bit at a specific position in the BitArray to the specified value in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 09:31:41

190 Views

To set the bit a specific position in the BitArray to the specified values, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       BitArray arr = new BitArray(5);       arr[0] = true;     ... Read More

ListDictionary Class in C#

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 08:11:12

392 Views

The ListDictionary class implements IDictionary using a singly linked list. It is recommended for collections that typically include fewer than 10 items.Following are the properties of ListDictionary class −Sr.NoProperty & Description1CountGets the number of key/value pairs contained in the ListDictionary.2IsFixedSizeGets a value indicating whether the ListDictionary has a fixed size.3IsReadOnlyGets ... Read More

Index of first occurrence in StringCollection in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 08:03:56

193 Views

To get the index of first occurrence in StringCollection, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo {    public static void Main() {       StringCollection strCol = new StringCollection();       strCol.Add("Accessories");       strCol.Add("Books");       strCol.Add("Electronics");   ... Read More

Getting an enumerator for the entire ArrayList in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 07:59:23

116 Views

To get an enumerator for the entire ArrayList in C#, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(String[] args) {       ArrayList list1 = new ArrayList();       list1.Add("A");       list1.Add("B");       ... Read More

MySQL query to fetch records before currentdate + 2 weeks?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 07:57:57

763 Views

For this, use the below syntax −select * from yourTableName where yourColumnName < DATE_ADD(CURDATE(), INTERVAL 2 WEEK);Note: The current date is as follows −mysql> select curdate(); +------------+ | curdate()  | +------------+ | 2019-10-20 | +------------+ 1 row in set (0.00 sec)Let us first create a table −mysql> create table DemoTable1607 ... Read More

Implement Harmonic mean and Quadratic mean in MySQL?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 07:43:05

142 Views

Let us first create a table −mysql> create table DemoTable1606    -> (    -> Value int    -> ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1606 values(5); Query OK, 1 row affected (0.10 sec) mysql> insert into ... Read More

Advertisements