Collections
Hi,
what is a collection in c#,when to use this collections
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Lalit MRank #1,186 · 1.5K reputationPosted Nov 30, 2009, 6:31 PM EST
The System.Collections namespace
The System.Collections namespace provides a lot of classes, methods and properties to interact with the varying data structures that are supported by it. The interfaces that are defined in this namespace include:
· IEnumerable
· IEnumerator
· ICollection
· IList
· IDictionary
The following are the classes that are derived from the ICollection interface.
· System.Collections.Stack
· System.Collections.Queue
· System.Collections.BitArray
· System.Collections.Specialized.NameValueCollection
The IDictionary interface represents collections that have name value pairs. The collections that inherit the IDictionary interface include:
· System.Collections.SortedList
· System.Collections.Hashtable
· System.Collections.Specialized.HybridDictionary
· System.Collections.Specialized.ListDictionary
The IList interface represents collections that only have value. The following are the classes that extend this interface.
· System.Array
· System.Collections.ArrayList
· System.Collections.Specialized.StringCollection
Show use of collection with examplesUSe of collection
Amit ChoudharyRank #145 · 15.8K reputationPosted Nov 30, 2009, 8:27 PM EST
Collections are just like arrays you can store more than one elements in one variable entity...
The main Difference is the collections are Dynamic.
means Dynamically CRUD operations can be performed and .net framework have provided properties and methods to manipulate the collections.
The above post is the Listing of available collections with their namespaces..
you can use collections according to your requirements like different types of Types can be stored in ArrayList and if you want to make them bound to specific Type then use Generics like List
And moreover you can use Dictionaries like HashTables and SortedLists where each value stored is associated with a key...
So Get the Sharp Edge of C-Sharp ....Enjoy Coding..... :)
srinivas137 reputationPosted Nov 30, 2009, 8:49 PM EST