Hi all
I know that generics are used to achieve type safety and i frequently read that they are largely used in custom collections. But why actually do we need to have it generic?
For example,
Why cant i use string[]
instead of List<string>
Lets consider i declare generic class and it has a property X
T x;
If i provide a method for the class which does
x = x + 1;
what does it mean actually? I dono what T is actually going to be and i dono what x = x + 1 going to perform actually?
If i'm not able to do my own manipulations in my methods how the generics are going to help me anyway?
I've already studied lot of bookish answers. It would be much appreciated if any one can provide some clear insights in this.
Regards NLV