I want to make some generic methods like this one
public static T maxValue(T value1, T value2 )
{
if(value1>value2)
return value1;
else
return value2;
}
And use it like
max<string>.maxValue("john","john");
My question is what should be the return type of the maxValue
function and how to use operators like +
, =
, <
, >
etc with generic types?
I know that T
has no defined data type. I need the improvement this code.