Proposal: Support using static readonly fields as default values for method parameters #9365
Unanswered
pikoscielniak
asked this question in
Language Ideas
Replies: 1 comment 2 replies
-
This is not really possible; IL requires default parameters to be constant. It's not a C# language decision. Maybe it could be faked with attributes, but that's not easy either. |
Beta Was this translation helpful? Give feedback.
2 replies
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.
-
I would like to propose, or inquire about the official support for, using static readonly fields as default values for method parameters.
I would like to propose that this construct be considered valid language syntax and compilable, but under the current rules, it is not allowed:
I was wondering if there are any plans to support something like this in the future?
Beta Was this translation helpful? Give feedback.
All reactions