Skip to main content

Posts

Showing posts with the label Generic Colletion

Non-Generic Collection and Generic Collection in.NET

What is Collection in.NET Microsoft .NET provides lots of collection data types that can store a set of records or values. there are two types of collections introduced by Microsoft in C#.NET, those are generic collections and non-generic collections. Generic collections are type-safe at compile time. so that it provides much better performance as compared to the non-generic collection. It supports a type parameter when they are constructed and do not require to do boxing-unboxing or type-conversation from the Object type when you add or remove items from the collection. Non-generic collections store items as Objects require casting, and most are not supported for Windows Store app development. However, you may see non-generic collections in older codes. by most developers, it is recommended to use the generic collection, because it is faster and safer also, there is less chance of exception and compile-time error with it. to use a non-generic collection in your code need to use the na