AmitDiwan has Published 10744 Articles

How to insert the elements of a collection into the List at the specified index in C#?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:27:32

283 Views

To insert the elements of a collection into the List at the specified index, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(String[] args){       string[] strArr = { "John", "Tom", "Kevin", "Mark", "Gary" };       ... Read More

How to get TypeCode in C#?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:25:28

183 Views

To get TypeCode in C#, 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());       Console.WriteLine("GetTypeCode = " ... Read More

How to get the Standard Input and Output Stream through Console in C#?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:23:12

401 Views

To get the standard input stream through Console, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(string[] args){       Console.WriteLine("Displaying standard input stream...");       Console.WriteLine("Standard Input Stream = "+Console.In);    } }OutputThis will produce the following output −Displaying ... Read More

How to get the remaining elements of the Tuple in C#?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:20:39

116 Views

To get the remaining elements of the Tuple, the Rest property is used. 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, 2000);       var ... Read More

First occurrence in the List that matches the specified conditions in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:15:55

478 Views

To get the first occurrence in the list that matches the specified conditions, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    private static bool demo(int i){       return ((i % 10) == 0);    }    public static void Main(String[] args){ ... Read More

Finding the index of last element in the array in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:13:23

269 Views

To find the index of the last element in the array, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       string[] products = new string[] { "Andy", "Mark", "Gary", "Andre"};       Console.WriteLine("One or more name begin with ... Read More

Find the first node in LinkedList containing the specified value in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:10:27

105 Views

To find the first node in LinkedList containing the specified value, 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("John");       list.AddLast("Tim");       list.AddLast("Kevin"); ... Read More

Enumerator that iterates through the BitArray in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:08:02

140 Views

Following is the code that iterates through the BitArray with Enumerator −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

Creating StringBuilder having specified capacity in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:04:42

105 Views

To create StringBuilder having specified capacity, the code is as follows −Example Live Demousing System; using System.Text; public class Demo {    public static void Main(String[] args){       StringBuilder strBuilder1 = new StringBuilder("Tim");       StringBuilder strBuilder2 = new StringBuilder("Tom");       StringBuilder strBuilder3 = new StringBuilder(); ... Read More

Creating a synchronized wrapper for a SortedList object in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 12:02:00

162 Views

To create a synchronized wrapper for a SortedList object, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       SortedList sortedList = new SortedList();       sortedList.Add("1", "Tom");       sortedList.Add("2", "Ryan");       sortedList.Add("3", ... Read More

Advertisements