Hi Dudes
Can any one help me that what is difference b/w Generic Collections and Non-Generic Collection and alo
Loading
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.
VulpesPosted Jun 27, 2011, 3:39 AM
In the .NET Framework, the non-generic collections (ArrayList, Hashtable, SortedKist, Queue etc.) store elements internally in 'object' arrays which, can of course, store any type of data.
This means that, in the case of value types (int, double, bool, char etc), they have to be 'boxed' first and then 'unboxed' when you retrieve them which is quite a slow operation.
Whilst you don't have this problem with reference types, you still have to cast them to their actual types before you can use them.
In contrast, generic collections (List
This means that generic collections are faster than their non-generic counterparts when using value types and more convenient when using reference types. In short, the latter are now virtually redundant.
Sandeep ShekhawatPosted Jun 27, 2011, 2:16 AM