[Proposal]: Omitted generic parameters when accessing constants defined in a generic type #8586
Unanswered
Flithor
asked this question in
Language Ideas
Replies: 1 comment 2 replies
-
The existing generic inference proposals wouldn't cover this case as there are nothing to infer. I, personally, don't see the language wading into generic wildcards for this specific use case. I'd suggest writing a separate non-generic class for that constant: public static class MyGenericType
{
public const string MY_CONST_STRING = "Constant String Content";
} |
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
-
When accessing a constant defined in a generic type, we must definate type parameters, but constants are stateless, and cannot be override or reset.
We should not need to input type parameters when accessing the constant value defined in generic type.
For example:
Now we should write:
I'd like:
My only concern is whether this breaks any basic c# syntax conventions?
Beta Was this translation helpful? Give feedback.
All reactions