Collections Articles

C# Collections – What is a Collection?

Admitted, we blew it in the first version of the framework with System.Collections.ICollection, which is next to useless. But we fixed it up pretty well when generics came along in .NET framework 2.0: System.Collections.Generic.ICollection<T> lets you Add and Remove elements, enumerate them, Count them and check for membership. Obviously from then on, everyone would implement […]

Read more

Developing Collection Classes In .NET

Collection resembles to grouping together theset of objects with the same characteristics, in programming paradigmit resembles to the set of object instances of the same class.In .NET, class libraries provides the collection interfaces that areused to develop one's own collection classes. The basic functionalityfor the collections is made available by inheriting the abstract(MustInherit in VB) […]

Read more

C# Collections

To construct and manipulate a collection of objects, .Net framework has provided us with many classes. ArrayList, BitArray, HashTable, SortedList, Queue and Stack are some of them. They are all included in System.Collections namespace. Download myQueue.cs Download myStack.cs In general, Arrays are not dynamic in nature and do not allow the user to remove an […]

Read more

C# Custom Collection Implementation

This sample shows a simple custom collection implementation in C# with the .NET Framework. using System;using System.Collections; namespace Personal.Demos.Simple{ public class MainApp{ //entry point 'Main' public static void Main(){ //get us some Widgets Widgets MyWidgets = Initialize(); Console.WriteLine("Using 'foreach' – "); //enumerate through the collection with //the foreach constuct. foreach(Widget W in MyWidgets){ //call the […]

Read more