Hello,
I want to know read all interfaces and properties,methods in Collection Classes(ArryList,HashTable,List,n Etc..).I have searched in MSDN library.Do i get more information from any other site?
Thanks 2 all.
Hello,
I want to know read all interfaces and properties,methods in Collection Classes(ArryList,HashTable,List,n Etc..).I have searched in MSDN library.Do i get more information from any other site?
Thanks 2 all.
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.
Mike GoldPosted Aug 10, 2007, 6:33 PM
Generic collections allow you to store an item in your collection of a specific type.
non-generic collections allow you to store objects of any type all inheriting form the System.Object class.
The biggest difference between the two types of collections, is that if you only need to store objects of a particular type (value or reference), then generic classes are much more efficient.
The reason generic classes are more efficient is that you don't have to unbox the object inside the collection to get to the class instance you have stored there.
Also it's easier to use a generic class as a programmer if all your objects are homogeneous because there is no coersion necessary for your type.
for example:
generic:
List listOfNumbers = new List(); // generic instance
list.Add(1); list.Add(2);
if I want to pull an element out of the list, I just need to get it directly:
int number = list[0];
// non - generic example
ArrayList list = new ArrayList();
list.Add(1);
list.Add(2);
In a non-generic collection, To assign the first stored element to a number, I need to unbox it from the object type.
int number = (int)list[0];
jaguRitaPosted Aug 10, 2007, 4:47 PM
Ok,Difference between Generic and Non-generic classes?
And from what are all the interfaces inheriting methods n properties for Generic collection classes ?
Please,Ur answer is valuable to me.
Thanks.