Overload resolution simplification

Andrey Breslav andrey.breslav at jetbrains.com
Mon Aug 12 00:04:20 PDT 2013

You are right, I'm too used to thinking of any context with a target type as an argument to some call. Thanks for the correction.

What I meant to say stands, though: C# disambiguates overloaded method references using the context information that sometimes includes type argument inference.

Andrey Breslav
Develop with pleasure!

On Aug 11, 2013, at 07:26 , Neal Gafter wrote:

> On Sat, Aug 10, 2013 at 12:07 AM, Andrey Breslav <andrey.breslav at jetbrains.com> wrote:
> The case of overloaded method references worries me as well (lambdas are ok). Note that C# supports overloaded method references (method groups) as arguments and only as arguments.
> That is not correct.  In C# you can use method groups in many contexts, but mainly they are useful in contexts that provide some kind of target type.  For example
> variable = object.MethodName;
> return object.MethodName;
> OverloadedMethod(object.MethodName);
> (TargetType)object.MethodName
> In fact, there is one context where a target type is not even required, though I'll leave that to you as a puzzle.
> Cheers,
> Neal Gafter
> C# compiler architect

More information about the lambda-spec-observers mailing list