proposals/csharp-13.0/method-group-natural-type-improvements.md
[!INCLUDESpecletdisclaimer]
Champion issue: https://github.com/dotnet/csharplang/issues/7429
This proposal refines the determination of the natural type of a method group in a few ways:
var x = M;)In C# 10, method groups gained a weak natural type.
That type is a "weak type" in that it only comes into play when the method group is not target-typed (ie. it plays no role in System.Action a = MethodGroup;).
That weak natural type allows scenarios like var x = MethodGroup;.
For reference: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/lambda-improvements.md#natural-function-type
A method group has a natural type if all candidate methods in the method group have a common signature. (If the method group may include extension methods, the candidates include the containing type and all extension method scopes.)
In practice, this means that we:
The principle is to go scope-by-scope and prune candidates that we know cannot succeed as early as possible (same principle used in overload resolution).
Relates to scope-by-scope proposal: https://github.com/dotnet/csharplang/issues/7364 Relates to proposal to better handle generic extension methods: https://github.com/dotnet/roslyn/issues/69222