I have an extension method like this:
public static class Extensions
{
public static TOut To<TIn, TOut>(this TIn value)
{
.......
}
}
but when I want to use it, compiler can not infer the input parameter type:
var i = 0;
var res = i.To<decimal>(); //compiler error, because compiler can not infer the TIn type that is integer
the curios part is that when I am using method To
without opening the <
the compiler shows that TIn
is integer
, but when I open the <
, compiler asks for TIn
too.