Take the 2-minute tour ×   static TDest
Gimme<TSource,TDest>(TSource source)      return default(TDest);
Why can't I do:  string dest = Gimme(5);  without getting the
compiler error:  error CS0411: The type arguments for method
'Whatever.Gimme<TSource,TDest>(TSource)' cannot be inferred from
the usage. Try specifying the type arguments explicitly.  The 5
can be inferred as int, but there's a restriction where the
compiler won't/can't resolve the return type as a string. I've
read in several places that this is by design but no real
explanation. I read somewhere that this might change in C# 4,
but it hasn't.  Anyone know why return types cannot be inferred
from generic methods? Is this one of those questions where the
answer's so obvious it's staring you in the face? I hope not!
share|improve this question  5 Answers 5  up vote 56 down vote
accepted  The general principle here is that type information
flows only "one way", from the inside to the outside of an
expression. The example you give is extremely si