Base of Difference | Generic | Non-Generic |
Definition | Generic collection is a claa which provides type safety without having to derive from a base collection type and then implement type specific members. | And on other hand Non-generic collection is specialized class for data storage and retrieval which basically provides support for stacks, queues, lists and hashtables. |
Type | Generic collection is strongly types. | Non-generic collection is not a strongly types. |
Namespace | Generic collection classes are in the System.Collections.Generics namespace. | Non-generic collection classes are in System.Collections namespace. |
Storing Elements | In Generic collections basically used to store elements internally in arrays of their actual types. | In Non-generic collections elements are store internally in object arrays so that it can store any type of data. |
Example | List<T>,Dictionary<TKey, TValue>,SortedList <TKey,TValue>,HastSet<T>,Queue<T>,Stack<T> | ArrayList, Queue,stack etc. |
TypeCast | There is not need for TypeCasting | Here programmer need to type cast to correct data type.
|
|
| |