-
Notifications
You must be signed in to change notification settings - Fork 1k
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]: Extensions as static types #8474
Comments
Please ship it already in C# 13!!! Or in the first preview of C# 14, if possible 🙂 |
As long as it doesn't compromise future designs (which it doesn't see to, considering it can be "expanded" to non-static later), I'm all for this as well. In a sense, this is similar to " |
Neither of those things are likely to happen. |
My only question might be how this would play for helper methods. Could a private extension method be in scope within the extension that could be called from other extension members? e.g.: public extension StringExtensions for string {
public void M() {
this.HelperMethod();
}
private void HelperMethod() { }
} or would you be expected to declare that helper method as a static method, like we do with extension methods today? public extension StringExtensions for string {
public void M() {
HelperMethod(this);
}
private static void HelperMethod(string value) { }
} The former would be nice... |
I I'm not sure why the prohibition of:
Necessitates the change to how |
|
Regarding the disambiguation section- will it not be possible to do: |
I'm not sure I understand the logic here. Let's imagine |
Extensions as static types
This has been moved to https://github.com/dotnet/csharplang/blob/main/meetings/working-groups/extensions/extensions-as-static-types.md.
The text was updated successfully, but these errors were encountered: