AmitDiwan has Published 10744 Articles

Get the types nested within the current Type C#

AmitDiwan

AmitDiwan

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

163 Views

To get the types nested within the current Type, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Type type1 = typeof(Subject);       try {          Type[] type2 = type1.GetNestedTypes();       ... Read More

Get a specific type nested within the current Type in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 10:49:41

98 Views

To get a specific type nested within the current Type, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Type type1 = typeof(Subject);       try {          Type type2 = type1.GetNestedType("AdvSubject");     ... Read More

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

AmitDiwan

AmitDiwan

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

253 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

156 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

125 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

111 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

345 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

249 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

309 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

Advertisements