Overload resolution simplification

Neal Gafter neal at gafter.com
Sat Aug 10 20:26:24 PDT 2013


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