+ 1
Multiple Generic parameter
I did not get multiple generic parameter <T,U> what is the use of it ? why we can't use <T,T> because in <T> it can takes all types?
3 Réponses
0
You can't use <T,T> because it makes no sense. Use <T> then. Effect is the same, but it is allowed.
Multiple generic parameter is used by Dictionary type, for example. First parameter is for key, and second is for value.
0
I didnt get what you want to reach by your quesion, anyways.. the generic parameter <T,T> is pointless, why? Because AS IN MATHs, if you have 2 formulas each one has the value X, and X is given a value of 5 for example, then, this 5 is in both formulas, same thing in Generics, <T,T> means two type parameters each one is same as the other, so when you use it, you can only apply 2 same types, Like <int,int> and that takes you to nowhere. But <T,U> means two DIFFERENT types each one has its settings in the method you are adding those parameters to.
0
The goal of using two different letters as in <T,U> is to tell that each letter is different then the other which ALSO means two different types in implementation.