[Proposal]: Extension members on typeless receivers #10145
Unanswered
CyrusNajmabadi
asked this question in
Language Ideas
Replies: 3 comments 1 reply
|
I want this so bad. |
0 replies
|
This would be great. I ran into this the other day and was disappointed/surprised that it didn't work for something like |
0 replies
|
Does this contain |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Extension members on typeless receivers
Summary
Allow extension members to be invoked on a receiver expression that has no type:
Resolution treats the receiver as the first argument of each candidate extension member, then picks the best applicable candidate by the existing overload-resolution rules. Receivers that already have a type bind by the existing rules, unchanged.
Design meetings
This proposal has not yet been reviewed by LDM. Prior LDM and working-group discussions that inform the design:
[complex, type, examples].AsImmutableArray()motivating scenario, with the broader claim that null, lambda, and method-group receivers should also participate.(x => true).ExtensionOnStringPredicate()example and explicit framing of the feature as extension methods on target-typed constructs.All reactions