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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
srinivasPosted Dec 1, 2009, 1:49 AM
Amit ChoudharyPosted Dec 1, 2009, 1:27 AM
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..... :)
Lalit MPosted Nov 30, 2009, 11:31 PM
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