- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 2628 Articles for Csharp
84 Views
To remove the specified node from the LinkedList, 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 value = "+val.Value); ... Read More
135 Views
To set the bit a specific position in the BitArray to the specified values, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main() { BitArray arr = new BitArray(5); arr[0] = true; arr[1] = false; arr[2] = true; arr[3] = false; Console.WriteLine("BitArray..."); foreach(Object ob in arr) { Console.WriteLine(ob); } arr.Set(2, false); Console.WriteLine("Updated BitArray..."); ... Read More
277 Views
The ListDictionary class implements IDictionary using a singly linked list. It is recommended for collections that typically include fewer than 10 items.Following are the properties of ListDictionary class −Sr.NoProperty & Description1CountGets the number of key/value pairs contained in the ListDictionary.2IsFixedSizeGets a value indicating whether the ListDictionary has a fixed size.3IsReadOnlyGets a value indicating whether the ListDictionary is readonly.4IsSynchronizedGets a value indicating whether the ListDictionary is synchronized (thread safe).5Item[Object]Gets or sets the value associated with the specified.6KeysGets an ICollection containing the keys in the ListDictionary.7SyncRootGets an object that can be used to synchronize access to the ListDictionary.8ValuesGets an ICollection containing the ... Read More
137 Views
To get the index of first occurrence in StringCollection, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo { public static void Main() { StringCollection strCol = new StringCollection(); strCol.Add("Accessories"); strCol.Add("Books"); strCol.Add("Electronics"); strCol.Add("Books"); Console.WriteLine("StringCollection elements..."); foreach (string res in strCol) { Console.WriteLine(res); } strCol.Insert(2, "Headphone"); Console.WriteLine("StringCollection elements...UPDATED"); foreach (string res in strCol) { Console.WriteLine(res); ... Read More
78 Views
To get an enumerator for the entire ArrayList in C#, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args) { ArrayList list1 = new ArrayList(); list1.Add("A"); list1.Add("B"); list1.Add("C"); list1.Add("D"); list1.Add("E"); list1.Add("F"); list1.Add("G"); list1.Add("H"); list1.Add("I"); Console.WriteLine("Elements in ArrayList1..."); foreach (string res in list1) { Console.WriteLine(res); } ... Read More
85 Views
To check whether a SortedList object contains a specific key in C#, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main() { SortedList list = new SortedList (); list.Add("A", "Books"); list.Add("B", "Electronics"); list.Add("C", "Appliances"); list.Add("D", "Pet Supplies"); list.Add("E", "Clothing"); list.Add("F", "Footwear"); Console.WriteLine("Value associated with key E = "+list["E"]); list["E"] = "HDD"; Console.WriteLine("Value associated with key E [Updated] = "+list["E"]); ... Read More
365 Views
To check whether a List contains the elements that match the specified conditions in C#, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { private static bool demo(int i) { return ((i % 3) == 0); } public static void Main(String[] args) { List list = new List(); list.Add(255); list.Add(315); list.Add(410); list.Add(500); list.Add(600); list.Add(710); list.Add(800); list.Add(1000); Console.WriteLine("List elements..."); ... Read More
62 Views
To get synchronize access to the Stack, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main() { Stack stack = new Stack(); stack.Push(100); stack.Push(200); stack.Push(300); stack.Push(400); stack.Push(500); Console.WriteLine("Stack..."); foreach(Object ob in stack) { Console.WriteLine(ob); } Console.WriteLine("Count of elements = "+stack.Count); Console.WriteLine("Synchronize access..."); lock(stack.SyncRoot) { ... Read More
66 Views
To get the specified 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.GetMember("SubName"); Console.Write("Members = "); for (int i = 0; i < info.Length; i++) Console.WriteLine(" {0}", info[i]); Console.WriteLine("FieldInfo = {0}", fieldInfo); } catch ... Read More
63 Views
To create a Queue from another collection, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main() { Queue queue = new Queue(); queue.Enqueue("One"); queue.Enqueue("Two"); queue.Enqueue("Three"); Console.WriteLine("Queue elements..."); foreach(string str in queue) { Console.WriteLine(str); } Console.WriteLine("Array elements..."); Queue arr = new Queue(queue.ToArray()); foreach(string str in arr) { Console.WriteLine(str); } ... Read More