
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

532 Views
To get an enumerator that iterates through the Dictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Generic; public class Demo { public static void Main(){ Dictionary dict = new Dictionary(); dict.Add(100, "Laptop"); dict.Add(150, "Desktop"); dict.Add(200, "Earphone"); dict.Add(300, "Tablet"); dict.Add(500, "Speakers"); dict.Add(750, "HardDisk"); dict.Add(1000, "SSD"); IDictionaryEnumerator demoEnum = dict.GetEnumerator(); Console.WriteLine("Enumerator iterating key-value pairs..."); while (demoEnum.MoveNext()) Console.WriteLine("Key = " + demoEnum.Key ... Read More

157 Views
To get an enumerator that iterates through StringCollection, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo { public static void Main(){ StringCollection stringCol = new StringCollection(); String[] arr = new String[] { "100", "200", "300", "400", "500" }; Console.WriteLine("Array elements..."); foreach (string res in arr){ Console.WriteLine(res); } stringCol.AddRange(arr); Console.WriteLine("Does the specified string is in the StringCollection? = "+stringCol.Contains("800")); Console.WriteLine("Total number of elements = "+stringCol.Count); ... Read More

203 Views
To remove all nodes from LinkedList, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main() { int [] num = {10, 20, 30, 40, 50}; LinkedList list = new LinkedList(num); Console.WriteLine("LinkedList nodes..."); foreach (var n in list) { Console.WriteLine(n); } list.Clear(); Console.WriteLine("LinkedList is empty now!"); foreach (var n in list) { Console.WriteLine(n); } } ... Read More

101 Views
To remove all entries from the StringDictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main(){ StringDictionary strDict1 = new StringDictionary(); strDict1.Add("A", "John"); strDict1.Add("B", "Andy"); strDict1.Add("C", "Tim"); strDict1.Add("D", "Ryan"); strDict1.Add("E", "Kevin"); strDict1.Add("F", "Katie"); strDict1.Add("G", "Brad"); Console.WriteLine("StringDictionary1 elements..."); foreach(DictionaryEntry d in strDict1){ Console.WriteLine(d.Key + " " + d.Value); } ... Read More

138 Views
To check if an array has fixed size or not, try the below code −Example Live Demousing System; public class Demo { public static void Main(){ string[] products = new string[] { "Electronics", "Accessories", "Clothing", "Toys", "Clothing", "Furniture" }; Console.WriteLine("Products list..."); foreach(string s in products){ Console.WriteLine(s); } Console.WriteLine("Is the products Accessories in the array? = {0}", Array.Exists(products, ele => ele == "Accessories")); Console.WriteLine("Is the products Stationery in the array? = {0}", ... Read More

459 Views
To check if an array contains the elements that match the specific conditions, we can use the StartsWith() method in C# −Example Live Demousing System; public class Demo { public static void Main(){ string[] products = { "Electronics", "Accessories", "Clothing", "Toys", "Clothing", "Furniture" }; Console.WriteLine("Products list..."); foreach(string s in products){ Console.WriteLine(s); } Console.WriteLine("One or more products begin with the letter 'C'? = {0}", Array.Exists(products, ele => ele.StartsWith("C"))); Console.WriteLine("One or more planets begin with 'D'? = ... Read More

108 Views
To check if a value is in LinkedList, try the below code −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(){ LinkedList linkedList = new LinkedList(); linkedList.AddLast(25); linkedList.AddLast(50); linkedList.AddLast(100); linkedList.AddLast(200); linkedList.AddLast(400); linkedList.AddLast(500); linkedList.AddLast(550); linkedList.AddLast(600); linkedList.AddLast(800); linkedList.AddLast(1200); Console.WriteLine("Count of nodes = " + linkedList.Count); foreach(int val in linkedList){ Console.WriteLine(val); } ... Read More

127 Views
To check if a HashSet and a specified collection share a common element, the C# 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); set1.Add(100); set1.Add(125); set1.Add(150); Console.WriteLine("Elements in HashSet1"); foreach(int val in set1){ Console.WriteLine(val); } HashSet set2 = new HashSet(); set2.Add(30); ... Read More

1K+ Views
The BitConverter class converts base data types to an array of bytes, and an array of bytes to base data types.Following are the methods −MethodDescriptionDoubleToInt64Bits(Double)Converts the specified double-precision floating-point number to a 64-bit signed integer.GetBytes(Boolean)Returns the specified Boolean value as a byte array.GetBytes(Char)Returns the specified Unicode character value as an array of bytes.GetBytes(Double)Returns the specified double-precision floating-point value as an array of bytes.GetBytes(Int16)Returns the specified 16-bit signed integer value as an array of bytes.GetBytes(Int32)Returns the specified 32-bit signed integer value as an array of bytes.Int64BitsToDouble(Int64)Reinterprets the specified 64-bit signed integer to a double-precision floating-point number.ToBoolean(Byte[], Int32)Returns a Boolean value converted ... Read More

211 Views
The Queue.Contains() method in C# is used to determine whether an element is in the Queue.SyntaxThe syntax is as follows -public virtual bool Contains (object ob);Above, the parameter ob is the Object to locate in the Queue.ExampleLet us now see an example - Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main() { Queue queue = new Queue(); queue.Enqueue("Gary"); queue.Enqueue("Jack"); queue.Enqueue("Ryan"); queue.Enqueue("Kevin"); queue.Enqueue("Mark"); queue.Enqueue("Jack"); queue.Enqueue("Ryan"); queue.Enqueue("Kevin"); Console.Write("Count ... Read More