Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
C#
Collections Data Structure 454 codes
Home
C#
Collections Data Structure
1 A collection of elements of type String
2 A dictionary with keys of type string and values of type String
3 A dictionary with keys of type string and values of type Type
4 A list implementation that is loaded the first the contents are examined
5 A queue class for characters
6 A run-time error occurs when Array Sort is called
7 A simple stable sorting routine - far from being efficient, only for small collections
8 A simple version of the Quicksort
9 A stack class for characters
10 A Stacked array is an integer array that contains a sequence of ascending integers
11 Add a list of items into the dictionary
12 Add array to ArrayList
13 Add element to SortedList
14 Add exception handling to the queue classes
15 Add Item to a list object
16 Add items to ArrayList and use foreach loop to check
17 Add one dictionary items into another Copy all the first dictionarys items into the second dictionary
18 Add OrderBy to IEnumerable
19 Add range to Collection
20 Add Repeat extension to IEnumerable
21 Add the word today to the beginning of the linked list
22 Add to SortedList, get by key and index
23 Add value to Hashtable and loop through the value key pairs
24 Add WhereIf to IEnumerable
25 Adds a new element to the specified collection
26 Adds a string to the end of the StringCollection
27 Adds all of the elements of the c collection to the target collection
28 Adds an entry with the specified key and value into NameObjectCollectionBase
29 Adds an entry with the specified key and value into the ListDictionary
30 Adds the elements of the specified collection to the specified generic IList
31 Adds the specified element to the specified collection
32 Aggregate IEnumerable
33 An Hashtable-backed dictionary that enumerates Keys and Values in insertion order
34 Are thos two arrays having the save contents
35 Are two arrays equal
36 Array 2D
37 Array AsReadOnly Method
38 Array Clone Method
39 Array Conversions
40 Array CreateInstance Method
41 Array FindAll Method
42 Array Resize Method
43 Array reverse and sort
44 Array Sort by CultureInfo
45 Array SyncRoot Property
46 ArrayList Demo
47 Arrays of Reference Types
48 Assigning array reference variables
49 Binary Search an ArrayList
50 Bit Array 2D
51 BitArray Class manages a compact array of bit values
52 BitArray CopyTo copies the entire BitArray to a compatible one-dimensional Array
53 BlockingCollection Provides blocking and bounding capabilities for thread-safe collections that implement IProd
54 Bubble sort
55 Build Statistics function on to IEnumerabledouble
56 Call GetLength for two dimenional array
57 CaseInsensitiveComparer Class compares two objects for equivalence, ignoring the case of strings
58 Catch IndexOutOfRangeException Exception
59 Catch OutOfMemoryException
60 Change Contents
61 Change the last node be yesterday
62 Change value for a key
63 Char Array Writer
64 CharEnumerator supports iterating over a String and reading its individual characters
65 Check InvalidCastException when using foreach loop with ArrayList
66 Check if the array contains needle on specified position
67 Checks time needed for list operations using an ArrayList implementation
68 Chunked List
69 Class array
70 Class array init
71 Clone a DictionaryK,V
72 Clone an ArrayList
73 Collection of static methods for operations on arrays
74 CollectionBase Provides the abstract base class for a strongly typed collection
75 CollectionsUtil CreateCaseInsensitiveHashtable()
76 CollectionsUtil CreateCaseInsensitiveSortedList()
77 Compare Array
78 Compare two arrays and two lists
79 Compare two IEnumerable
80 Compare two Lists
81 Comparer Class Compares two objects for equivalence, where string comparisons are case-sensitive
82 Compares the efficiency of the hash map implementation with the tree map
83 Compares the two values passed in and checks if theyre value-wise the same
84 Compares two sequences
85 Compute the average of a set of values
86 Compute the average of a set of values 2
87 Computes the indices
88 Concatenate Array
89 Concatenate IEnumerablestring to String
90 ConcurrentBag represents a thread-safe, unordered collection of objects
91 ConcurrentQueue represents a thread-safe first in-first out (FIFO) collection
92 ConcurrentStack represents a thread-safe last in-first out (LIFO) collection
93 Contains key
94 Contains value
95 ContainsKey can be used to test keys before inserting them
96 Convert a ArrayList object to a array
97 Convert a collection of strings to a comma separated list
98 Convert an ArrayList into an array
99 Convert array content to generic type array
100 Convert ICollection to T[]
101 Convert ICollectionT to T[]
102 Convert IEnumerable by Func
103 Convert IEnumerable To DataTable
104 Convert IEnumerable to IEnumerableT
105 Convert IEnumerable to ObservableCollection
106 Convert IEnumerable to String
107 Convert IEnumerableT to HashSetT
108 Convert IEnumerableT To ReadOnlyCollectionT
109 Convert List To Array
110 Convert object array to string
111 Convert XmlNodeList to IEnumerableSystem Xml XmlNode
112 ConvertAll ICollectionTIn to TOut[] with ConverterTIn, TOut
113 Converts an ICollection instance to an ArrayList instance
114 Converts an System Collections ICollection instance to an System Collections ArrayList instance
115 Converts the elements in the current ListT to another type, and returns a list containing the converted element
116 Converts the specified collection to its string representation
117 Copies a range of elements from the ListT to a compatible one-dimensional array, starting at the specified inde
118 Copies the elements of the ICollection to a new array of the specified element type
119 Copies the entire StringCollection values to a one-dimensional array of strings
120 Copies the ListDictionary to an array with DictionaryEntry elements
121 Copy an array
122 Copy an array into another array
123 Copy key out
124 CopyClone all the element from a dictionary to another
125 CopyTo, ToArray(), ToArray(typeof(String))
126 Counting the distribution of the values in an array
127 Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer
128 Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer, based on the Invaria
129 Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer, based on the Turkish
130 Create a SortedList using CaseInsensitiveComparer based on the Turkish culture (tr-TR)
131 Create a SortedList using case-insensitive comparer
132 Create a SortedList using the default comparer
133 Create a SortedList using the specified CaseInsensitiveComparer
134 Create a SortedList using the StringComparer InvariantCultureIgnoreCase value
135 Create Hashtable by copying the elements from the specified dictionary to the new Hashtable object
136 Create Hashtable using a case-insensitive code provider and a case-insensitive comparer, based on the culture o
137 Create LinkedList Generic Class with a string array
138 Create SortedList sorted according to the specified IComparer
139 Creates a list by applying a delegate to pairs of items in the IEnumerableT
140 Creates a list by combining two other lists into one
141 Creates a list by repeating another list
142 Creates a new array with just the specified elements
143 Creates an and array and looks for the index of a given value from either end
144 Creates and accesses an array of classes Implements the IComparable interface
145 Creates and implements an instance of Array
146 Cyclic Queue
147 Declare all kinds of arrays
148 Defines a 2D Array
149 Delete element in a SortedList with RemoveAt
150 Deletes a key
151 Demonstrate a one-dimensional array
152 Demonstrate a SortedList
153 Demonstrate a two-dimensional array
154 Demonstrate an array overrun
155 Demonstrate ArrayList
156 Demonstrate BitArray
157 Demonstrate Hashtable
158 Demonstrate jagged arrays
159 Demonstrate Length with jagged arrays
160 Demonstrate the Bubble sort
161 Demonstrate the Queue class
162 Demonstrate the Stack class
163 Dequeue
164 Determine whether a given collection only contains a single unique object
165 Determines whether an element is in the ListT
166 Determines whether the collection contains all the elements in the specified collection
167 Determines whether the collection contains the specified element
168 Determines whether the ListDictionary contains a specific key
169 Determines whether the ListT contains elements that match the conditions defined by the specified predicate
170 Determines whether the specified collection is null or empty
171 Determines whether the specified string is in the StringCollection
172 Dictionary List
173 Dictionary Pretty Print
174 Dictionary to anonymous type
175 Dictionary(TKey, TValue) represents a collection of keys and values
176 DictionaryBase Class Provides the abstract base class for a strongly typed collection of keyvalue pairs
177 DictionaryEntry Structure Defines a dictionary keyvalue pair that can be set or retrieved
178 Display the contents of the collection using foreach This is the preferred method
179 Display the contents of the collection using the enumerator
180 Displays the elements using the Keys, Values, Count, and Item properties
181 Displays the properties and values of the BitArrays
182 Do all for IEnumerable and Action
183 Dynamic Array
184 Empty EnumerableEnumerator
185 Ensures that the bool array cannot hold more than maxCapacity elements
186 Ensures that the char array cannot hold more than maxCapacity elements
187 Ensures that the double array cannot hold more than maxCapacity elements
188 Ensures that the float array cannot hold more than maxCapacity elements
189 Ensures that the int array cannot hold more than maxCapacity elements
190 Ensures that the long array cannot hold more than maxCapacity elements
191 Ensures that the object array cannot hold more than maxCapacity elements
192 Ensures that the sbyte array cannot hold more than maxCapacity elements
193 Ensures that the short array cannot hold more than maxCapacity elements
194 Enumerates an array using an enumerator object
195 Enumerating a hash table collection
196 EqualityComparer(T) Class provides a base class for implementations of the IEqualityComparerT generic interface
197 Evented List
198 Extends CollectionT to create Set
199 Extends DictionaryBase
200 Filter IEnumerableT with PredicateT
201 Find All Index
202 Find subarray in the source array
203 Finds a value of the given type in the given collection
204 FixedSizeStack provides an easy Stack implementation width a fixed size to prevent Stack Overflows in another s
205 Flatten a List
206 For each IEnumerable
207 For each KeyValuePair
208 Foreach is used to display the contents of an array of integers
209 Generic Growable Array
210 Generic Paged List
211 Generic Set
212 Get a array of object from a enum datatype
213 Get array size
214 Get Distinct value from a List
215 Get IDictionaryEnumerator enumerator from Hashtable
216 Get Search List
217 Get the array slice between the two indexes
218 Get the size of a list
219 Gets a collection of values in the StringDictionary
220 Gets the value of the bit at a specific position in the BitArray
221 Gets the value of the entry at the specified index of NameObjectCollectionBase
222 Given a range (start,end) and a number of steps, will yield that a number for each step
223 Group the collection using a function which returns the key
224 Groups items into same size lots
225 Hash List to Hash Array
226 Hash Set
227 Hash Set 2
228 Hashtable Clear Method removes all elements from the Hashtable
229 Hashtable Contains Method determines whether the Hashtable contains a specific key
230 Hashtable CopyTo Method copies the Hashtable elements to a one-dimensional Array instance at the specified inde
231 Hashtable GetEnumerator Method returns an IDictionaryEnumerator that iterates through the Hashtable
232 Hashtable IsSynchronized Property gets a value indicating whether access to the Hashtable is synchronized (thre
233 Hashtable Remove Method removes the element with the specified key from the Hashtable
234 IComparable Interface defines a type-specific comparison
235 IComparer Interface Exposes a method that compares two objects
236 IEnumerable extension for get second and third element
237 IEnumerable interface exposes the enumerator, which supports a simple iteration over a non-generic collection.t
238 IEnumerable To Comma String
239 IEnumerator interface supports a simple iteration over a nongeneric collection
240 IList Interface represents a non-generic collection of objects that can be individually accessed by index
241 Illustrates an attempt to write to a nonexistent array element
242 Illustrates how to initialize arrays
243 Illustrates how to use array properties and methods
244 Illustrates how to use arrays 2
245 Illustrates the use of a BitArray
246 Illustrates the use of a Hashtable
247 Illustrates the use of a Queue
248 Illustrates the use of a SortedList
249 Illustrates the use of a Stack
250 Illustrates the use of a two-dimensional rectangular array
251 Illustrates the use of an array of objects
252 Illustrates the use of an ArrayList that contains objects of the Car class
253 Illustrates the use of ArrayList properties and methods
254 Illustrates the use of ArrayLists 2
255 Illustrates the use of BitArray methods
256 Illustrates the use of the Hashtable methods
257 Illustrates the use of the SortedList methods
258 Implement GetHashCode method and store it in a hashtable
259 Implement IComparable
260 Implements a non-locking queue
261 Implements IDictionary by using a ListDictionary while the collection is small, and then switching to a Hashtab
262 Implements the IComparable interface
263 Implements the LinkedList data structure
264 Implements the queue data type using an array
265 Implements the recursive merge sort algorithm to sort an array
266 Implements the stack data type using an array
267 Indicate, by using parentheisis, the last occurence of the
268 Initialize a two-dimensional array
269 Initialize a two-dimensional rectangular array, and use the array properties and methods
270 Initializes a new instance of the LinkedListT class that is empty
271 Insert Sort
272 Inserting into an ArrayList by index
273 Inverts all the bit values in the current BitArray
274 Is a Collection Null Or Empty Or Default
275 Jagged Array Demo
276 Join IEnumerable
277 Keyed Collection
278 Keyed List
279 Lambda Collections Generic Set
280 Lazy List
281 LinkedListNode(T) Class represents a node in a LinkedListT This class cannot be inherited
282 List(T) Class represents a strongly typed list of objects that can be accessed by index
283 ListDictionary Class implements IDictionary using a singly linked list
284 Load elements into a generic list from an array
285 Loop through StringDictionary with IEnumerator and get DictionaryEntry
286 Merges two dictionaries
287 Mode value for IEnumerabledouble
288 Move and copy Directory
289 Move the first node to be the last node
290 Move the last node to be the first node
291 Multi Dimensional Arrays
292 Multi dimensional Arrays 1
293 Multidimensional and Jagged Arrays
294 Name Value Pair List
295 NameObjectCollectionBase Demo
296 NameObjectCollectionBase is the base class for a collection of associated String keys and Object values
297 New ListAssemblyName() Add(assembly1) Indexer
298 New Stack(new int[] { 1, 2, 3, 4, 5, 6 })
299 New StackAssemblyName())
300 Object class extension for IEnumerable, IComparable and where
301 Observable Collection demo
302 OrderedDictionary Class Represents a collection of keyvalue pairs that are accessible by the key or index
303 Output DataTable and IEnumerable to console
304 Overflow Stack
305 Paged List
306 Parametr Collection
307 Performing OR between BitArray instances of different sizes returns an exception
308 Performs bitwise exclusive OR operation
309 Performs the bitwise OR operation
310 Performs the specified action on each element of the IEnumerableT
311 Performs the specified action on each element of the ListT
312 Places elements from an enumerable into an array
313 Priority Queue
314 Priority Queue (2)
315 Properties based on Hashtable
316 Put an element into the Dictionary
317 Put elements into a queue
318 Put the Set class into its own namespace
319 Put user-defined objects to Queue collection
320 Queue test
321 Queue(T) Class represents a first-in, first-out collection of objects
322 Quick Sort
323 Red Black Tree
324 Reinitializes an int array to the given value in an optimized way
325 Remove element from Array
326 Remove element from OrderedDictionary
327 Remove Item from a List
328 Remove Key
329 Remove range from ArrayList
330 Removes all entries from NameObjectCollectionBase
331 Removes all the elements from the collection
332 Removes all the elements from the target collection that are contained in the source collection
333 Removes all the strings from the StringCollection
334 Removes the entries with the specified key from NameObjectCollectionBase
335 Removes the specified element from the collection
336 Represents a collection of associated String keys and String values
337 Represents a dictionary which stores the values as weak references instead of strong references
338 Represents a loose abstraction of an arraylist, wheres the buffer array is available for public access
339 Retains the elements in the target collection that are contained in the specified collection
340 Return the average of the given values
341 Return the max value in the list of double
342 Return the min value in the list of double
343 Return the percentage of a given value
344 Returns a Boolean indicating whether the Array is Empty (is Null or has a length of zero)
345 Returns a String array that contains all the keys in NameObjectCollectionBase
346 Returns a string representation of the bool value array
347 Returns a string representation of the char array
348 Returns a string representation of the double array
349 Returns a string representation of the float array
350 Returns a string representation of the int array
351 Returns a string representation of the long array
352 Returns a string representation of the object array
353 Returns a string representation of the sbyte array
354 Returns a string representation of the short value array
355 Returns an array containing all the elements of the collection
356 Returns the first element contained in both, source and candidates
357 Returns the index of the first occurrence in a sequence by using a specified IEqualityComparer
358 Returns the index of the first occurrence in a sequence by using the default equality comparer
359 Returns true if there are enough items in the IEnumerableT
360 Returns true if there are no more than a set number of items in the IEnumerableT
361 Reverse a ListT
362 Reverse an array
363 Reverse an array 2
364 Reverse Contents
365 Reverses the order of the elements in the specified range
366 Scoped Dictionary
367 Search for the first occurrence of the duplicated value
368 Search for the first occurrence of the duplicated value in a section of the ArrayList
369 Search for the first occurrence of the duplicated value in a small section at the end of the ArrayList
370 Search for the first occurrence of the duplicated value in the last section of the ArrayList
371 Search Test
372 Searches a range of elements in the sorted ListT for an element using the specified comparer and returns the ze
373 Searches for a key
374 Searches for object and returns the zero-based index
375 Searches for object and returns the zero-based index of the last occurrence
376 Searches for the specified object and returns the index of the first occurrence within the entire one-dimension
377 Sequence is an abstraction of a data reseqeuncer
378 Sets the value of the entry at the specified index of NameObjectCollectionBase
379 Shuffle IEnumerable
380 Shuffles the specified list
381 Simple function to determine if an item is an IEnumerable
382 Singleton IEnumerableT
383 Sleep before yield each element in IEnumerable
384 Slice list
385 Sort an array and search for a value
386 Sort and search an array of objects
387 Sort and search an ArrayList
388 Sortable Observable Collection
389 Sorted Collection
390 SortedList Add Method Adds an element with key and value to a SortedList object
391 SortedList Clear removes all elements from a SortedList object
392 SortedList Contains Determines whether a SortedList object contains a specific key
393 SortedList CopyTo copies SortedList elements to a one-dimensional Array object
394 SortedList GetByIndex gets the value at the specified index of a SortedList object
395 SortedList IndexOfKey returns the zero-based index of the specified key in a SortedList object
396 SortedList IsSynchronized tells whether access to a SortedList object is synchronized (thread safe)
397 SortedList is a collection of keyvalue pairs that are sorted by the keys and are accessible by key and by index
398 SortedList Remove removes the element with the specified key from a SortedList object
399 SortedList SetByIndex replaces the value at a specific index in a SortedList object
400 Sorting and Searching
401 Sorts an array of data using the insertion sort algorithm
402 Sorts and array in ascending order, then reverses the elements
403 Split IEnumerable
404 Stack abstraction that also supports the IList interface
405 Stack demo
406 Stack to array
407 Stack(T) Class represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrar
408 Stores a sequence of temperatures in an array
409 StringCollection represents a collection of strings
410 StringComparer Create(turkish, true)
411 StringComparer CurrentCulture
412 StringComparer CurrentCultureIgnoreCase
413 StringComparer InvariantCultureIgnoreCase
414 StringComparer Ordinal
415 StringComparer OrdinalIgnoreCase
416 StringComparer Represents a string comparison operation
417 StringDictionary Class implements a hash table with the key and the value strongly typed to be strings rather t
418 StringEnumerator supports a simple iteration over a StringCollection
419 Sum the values on a diagonal of a 3x3x3 matrix
420 Sums the values in an array using a foreach loop 1
421 Swap two elements in a array
422 Syncronized Queue
423 System Array
424 System Array Type
425 Task queue
426 Tests if the specified object is a collection and converts it to its string representation
427 The indexer throws an exception if the requested key is not in the dictionary
428 The use of a jagged array
429 The use of a three-dimensional rectangular array
430 Thread Safe Stack
431 To get the keys alone, use the Keys property
432 To get the values alone, use the Values property
433 Try to add duplicate entry to Dictionary
434 Two Key Dictionary
435 Use BitArray collection as Flag
436 Use IComparer
437 Use IDictionaryEnumerator to loop through OrderedDictionary
438 Use object to create a generic array
439 Use ReadOnlyCollection to wrap a collection
440 Use SortedDictionary to store class implementing System IComparable
441 Use the Length array property
442 Use the Length array property on a 3-D array
443 Use the Remove method to remove a keyvalue pair
444 Use TryGetValue to get a value out
445 Uses a jagged array to store sales figures
446 Uses a recursive method to implement binary search
447 Uses a two-dimensional array to store grades for students
448 Uses the Array Copy() method to copy an array of ints into an array of doubles 2
449 Uses the Array Copy() method to copy part of an array ints into a secton of an array of doubles
450 Using foreach to loop through ArrayList and use Indexer of ArrayList
451 Weak Collection
452 Whether NameObjectCollectionBase contains entries whose keys are not null
453 Whether NameObjectCollectionBase is read-only
454 Yield element in IEnumerable until Predicate