I have the a method with the following signature;
private static void CheckValue<T>(ref Double result, Int64 value, String condition, T checkValue) where T : class{};
The checkValue can be a Double or an Int64. However it gives the following error;
Operator '>=' cannot be applied to operatands of type 'long' and 'T'
Because I want a generic function and do not want to define two functions (One with the Int64 checkValue and one with the Double checkValue signature), I came up with T.
I used the where T : class, this way it limits T to classes and can use operators. (Found this on the following topic): How to solve Operator '!=' cannot be applied to operands of type 'T' and 'T'
I can imagine that this works if I can restrain T to only Int64 or Double. However if I change the following in the signature:
where T : class, Int64, Double
It gives the same error.
@Edit - 06-08-2015 11:16 My bad, If I run the prior it gives an error about the Int64 and Double in the where clause. (It is not a valid constraint)