Monday, January 3, 2011

Generics in DotNet

I always learn things by comparing to stuffs I already know!!!

Generics mainly have 4 parts;

1. List

List is a better way of doing ArrayList. ArrayList is flexible enough to store any kind of data. It treats every entry as objects. This is not a good thing when it come to type conversiion both in terms of perdormance and operation. That's where the importance of type safe list comes in to the picture. When the collection is more type safe, it is less prone to errors.
So List is a arrayList kind of collection where you are restricted to store only specific type, but unlimited.
eg: List ids=new List;
List ids=new List;

2. Dictionary

We can compare Dictionary to HashTable.

No comments:

Post a Comment