
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

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); list.AddLast(300); list.AddLast(400); list.AddLast(500); list.AddLast(300); list.AddLast(500); Console.WriteLine("LinkedList elements..."); foreach(int i in list) { Console.WriteLine(i); } LinkedListNode val = list.FindLast(300); Console.WriteLine("Specified ... Read More

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 the SortedSet, as defined by the comparer.4MinGets the minimum value in the SortedSet, as defined by the comparer.Following are some of the methods of the SortedSet class −Sr.NoMethod & Description1Add(T)Adds an element to the set and returns a value that indicates if it was successfully added.2Clear()Removes all elements from the ... Read More

127 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 = "+val2); Console.WriteLine("HashCode for value1 = "+val1.GetHashCode()); Console.WriteLine("HashCode for value2 = "+val2.GetHashCode()); Console.WriteLine("Are they equal? = "+(val1.Equals(val2))); TypeCode type1 = val1.GetTypeCode(); TypeCode type2 = val2.GetTypeCode(); Console.WriteLine("TypeCode for val1 = "+type1); ... Read More

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"); MemberInfo[] info = type.GetMembers(); Console.Write("Members = "); for (int i = 0; i < info.Length; i++) Console.WriteLine(" {0}", info[i]); Console.WriteLine("FieldInfo = {0}", fieldInfo); } ... Read More

346 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"); hash.Add("C", "AUV"); Console.WriteLine("Hashtable elements..."); foreach(DictionaryEntry d in hash) { Console.WriteLine(d.Key + " " + d.Value); } Console.WriteLine("Count of Key/value pairs = "+hash.Count); hash.Add("D", "Utility Vehicle"); hash.Add("E", "Convertible"); ... Read More

251 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); stack.Push(200); stack.Push(225); stack.Push(250); Console.WriteLine("Elements in the Stack:"); foreach(var val in stack) { Console.WriteLine(val); } Console.WriteLine("Count of elements in the Stack = "+stack.Count); ... Read More

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"); list.Add("Three"); list.Add("Four"); list.Add("Five"); list.Add("Six"); list.Add("Seven"); list.Add("Eight"); Console.WriteLine("ArrayList elements..."); foreach(string str in list) { Console.WriteLine(str); } Console.WriteLine("ArrayList is read-only? ... Read More

128 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(); TypeCode type2 = val2.GetTypeCode(); Console.WriteLine("Typecode for val1 = "+type1); Console.WriteLine("Typecode for val2 = "+type2); } }OutputThis will produce the following output −Typecode for val1 = UInt32 Typecode for val2 = UInt32ExampleLet us see another example − Live Demousing System; public class Demo { ... Read More

538 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 = type.GetInterfaces(); Console.WriteLine("Interface = "+myInterface); Console.WriteLine("All the Interfaces..."); for (int i = 0; i < myInterfaces.Length; i++) Console.WriteLine(""+myInterfaces[i]); } }OutputThis will produce the following output −Interface = System.IFormattable All the Interfaces... System.IComparable System.IFormattable System.IConvertible System.IComparable`1[System.Single] System.IEquatable`1[System.Single]Let us see another example −Example Live ... Read More

125 Views
To get a specific interface 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(double); Type myInterface = type.GetInterface("IFormattable"); Console.WriteLine("Interface = "+myInterface); } }OutputThis will produce the following output −Interface = System.IFormattableExampleLet us see another example − Live Demousing System; public class Demo { public static void Main() { Type type = typeof(float); Type myInterface = type.GetInterface("IFormattable",true); Console.WriteLine("Interface = "+myInterface); } }OutputThis will produce the following output −Interface = System.IFormattable