Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Allow extension methods for operators #14268

Closed
ThadHouse opened this issue Oct 4, 2016 · 2 comments
Closed

Proposal: Allow extension methods for operators #14268

ThadHouse opened this issue Oct 4, 2016 · 2 comments

Comments

@ThadHouse
Copy link
Contributor

With the addition of Ref locals to C# 7, a lot of new possibilities have been created. One of the biggest I can think of is allow reference wrappers to struct types. For certain things, this can be very nice. However, to place a struct in that reference wrapper, you would always have to new the wrapper, unless you implement an implicit conversion in the structure. However, in some cases the structure class is not known, so you cannot create that conversion. Looking through the IL generated by an extension method and an implicit operator, it looks like both pieces of code look the same.

My proposal would be to allow extension methods to extend operators in order to make this an easier case. It does not look like these would require a new version of the CLR.

@svick
Copy link
Contributor

svick commented Oct 4, 2016

I'm not sure I completely understand what you're proposing, but it sounds like this is a duplicate of a part of #11159.

@gafter
Copy link
Member

gafter commented May 6, 2019

Closing for lack of follow-up. Please reopen in csharplang if you're still interested in pursuing this.

@gafter gafter closed this as completed May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants