Tuesday 22 August 2017

Generic Collection Vs Non Generic Collection in C#



Generic collections - These are the collections that can hold data of same type and we can decide while initializing what type of data that collections can hold. 
Advantages - Type Safe, Secure, reduced overhead of implicit and explicit conversions. 

Generic collections Example: (List<T>, Dictionary<T, U>, SortedList<T, U>, Queue<T> etc) 

Non generic collections hold elements of different data types, it hold all elements as object type. 
so it includes overhead of implicit and explicit conversions.

Non-generic collections Example: (ArrayList, Hashtable, SortedKist, Queue etc.) 

2 comments: