Look at this:
s => s.Length;
How's the compiler suppose to know whether or not s
is a string
or s
is an array or some other type that has a Length
property? It can't, unless you give it some information:
(string s) => s.Length;
Oh, there we go. So now, try this:
myFirstObject.Extension((myOtherObject o) => o.Prop > 2 && o.Prop < 15);
That will work, because you've told the compiler what it should use for TIn
, and it can figure out what to use for TKey
based on the expression.