AmitDiwan has Published 10740 Articles

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

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:44:25

284 Views

To find the index of first 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 last node in LinkedList containing the specified value in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:37:42

181 Views

To find the last 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(100);       list.AddLast(200);       ... Read More

SortedSet Class in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:31:56

1K+ Views

The SortedSet class in C# represents a collection of objects that is maintained in sorted order.Following are the properties of the SortedSet class −Sr.NoProperty & Description1ComparerGets the IComparer object that is used to order the values in the SortedSet.2CountGets the number of elements in the SortedSet.3MaxGets the maximum value in ... Read More

Get the TypeCode for value type Int16 in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:25:09

144 Views

To get the TypeCode for value type Int16, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       short val1 = 0;       short val2 = Int16.MaxValue;       Console.WriteLine("Value1 = "+val1);       Console.WriteLine("Value2 ... Read More

Get the members of the current Type in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:21:31

126 Views

To get the members of the current Type, the code is as follows −Example Live Demousing System; using System.Reflection; public class Demo {    public static void Main() {       Type type = typeof(Subject);       try {          FieldInfo fieldInfo = type.GetField("SubName");     ... Read More

Count the number of key/value pairs in the Hashtable in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:17:20

369 Views

To count the number of key/value pairs in the Hashtable, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable hash = new Hashtable();       hash.Add("A", "SUV");       hash.Add("B", "MUV");     ... Read More

Insert an object at the top of the Stack in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:12:29

284 Views

To insert an object at the top of the Stack, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       Stack stack = new Stack();       stack.Push(100);       stack.Push(150);       stack.Push(175); ... Read More

Insert an element into the ArrayList at the specified index in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:08:05

336 Views

To insert an element into the ArrayList at the specified index, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       ArrayList list = new ArrayList();       list.Add("One");       list.Add("Two");       ... Read More

Get the TypeCode for value type UInt32 in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:04:29

144 Views

To get the TypeCode for value type UInt32, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       uint val1 = 55;       uint val2 = 100;       TypeCode type1 = val1.GetTypeCode();       ... Read More

Get all the interfaces implemented or inherited by the current Type in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:01:43

567 Views

To get all the interfaces implemented or inherited by the current Type, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Type type = typeof(float);       Type myInterface = type.GetInterface("IFormattable", true);       Type[] myInterfaces ... Read More

Advertisements