What is TProperty in c#?
I saw a code like this:
public abstract class Myclass<T, TProperty> : ....
I know that T is a generic type for the type we are passing. Is TProperty also the same as T.
What is TProperty in c#?
I saw a code like this:
public abstract class Myclass<T, TProperty> : ....
I know that T is a generic type for the type we are passing. Is TProperty also the same as T.
Anything inside the <>
is a generic type indicator. It's name does not make any difference to the compiler, but it should be meaningful for code readability.
Just like in Dictionary<TKey, TValue>
.
Of course it has to be unique to it's scope, inclusive of variable names in that scope.
Note that type indicators are not variables, but the Do collide with variable names (Thank you Aravol for your comment on that).
TProperty
is a second generic parameter.
Tuple<T1...T7, TRest>
for eaxmple.From the description of the class you provide:
public abstract class Myclass<T, TProperty> : ....
It appears the person who created the class intends for an object (T) and an object property (TProperty) to be supplied whenever creating the class.
A best guess would be something like this:
var mine = new Myclass<Generic.List, String>();
It is hard to tell without any more code or the context of how the code is used, though.