C Sharp SortedList

C# SortedList<TKey, TValue> The SortedList<TKey, TValue> class is used to store the values in ascending order based on the key as an array of key/value pairs. Found in the System.Collections.Generic namespace, the C# SortedList<TKey, TValue> class contains unique keys only, thus the stored elements can be easily searched or removed using the key. The SortedList<TKey, … Read more

Categories C#

C Sharp SortedDictionary

C# SortedDictionary<TKey, TValue> The concept of the hashtable is used by the C# SortedDictionary<TKey, TValue> class to store values in ascending order based on key. Found in the System.Collections.Generic namespace, the C# SortedDictionary<TKey, TValue> class contains unique keys only, thus the stored elements can be easily searched or removed using the key. Example: using System; … Read more

Categories C#

C Sharp Dictionary

C# Dictionary<TKey, TValue> The concept of the hashtable is used to store the values based on a key in a C# Dictionary<TKey, TValue> class. Found in the System.Collections.Generic namespace, the C# Dictionary<TKey, TValue> class contains unique keys only, thus the stored elements can be easily searched or removed using the key. Example: using System; using … Read more

Categories C#

C Sharp LinkedList

C# LinkedList<T> To add and remove an element before or after the last index, the concept of a linked list is used in the C# LinkedList<T> class, thus facilitating a fast insertion and deletion of the elements. Found in the System.Collections.Generic namespace, the duplicate elements can also be stored in the C# LinkedList<T> class. Unlike … Read more

Categories C#

C Sharp Queue

C# Queue<T> To Enqueue and Dequeue elements using the concept of Queue where elements are arranged in the First In First Out (FIFO) order, the C# Queue<T> class is used which is found in the System.Collections.Generic namespace. Duplicate elements can also be stored in a C# Queue<T> class. Example: using System; using System.Collections.Generic;   public … Read more

Categories C#

C Sharp Stack

C# Stack<T> To push and pop the elements using the concept of the Stack where the elements are arranged in the Last In First Out (LIFO) order, the C# Stack<T> class is used which is found in the System.Collections.Generic namespace. Duplicate elements can also be stored in a C# Stack<T> class. Example: using System; using … Read more

Categories C#

C Sharp SortedSet

C# SortedSet<T> To store elements in ascending order or to remove or view the stored elements in C#, the SortedSet class is used which is found in the System.Collections.Generic namespace. The duplicate elements can not be stored by the SortedSet class in C#, thus it is used to store the unique elements in ascending order. … Read more

Categories C#

C Sharp HashSet

C# HashSet<T> To store, remove or view the elements, the HashSet<T> class is used in C# which is found in the System.Collections.Generic namespace. The C# HashSet<T> class can not store duplicate elements, and thus it is recommended to use for storing the unique elements only. Example 1: using System; using System.Collections.Generic;   public class Example … Read more

Categories C#

C Sharp List

C# List<T> To store and to fetch the elements, the C# List<T> class is used which is found in the System.Collections.Generic namespace. The C# List<T> class can also store duplicate elements. Example: using System; using System.Collections.Generic;   public class Example { public static void Main(string[] args) { // Create a list of strings var countries … Read more

Categories C#

C Sharp Collections

C# Collections A group of objects is represented by a collection in C#, which is also used to perform different operations on objects which are listed below: store object update object delete object retrieve object search object, and sort object Thus the C# collections perform all the data structure work. Just like an array, a … Read more

Categories C#