Static Indexers #4341
Unanswered
osamakawish
asked this question in
Language Ideas
Static Indexers
#4341
Replies: 2 comments
-
I wonder if there are any potential syntax ambiguous. There is also slight inconsistency. You declared the indexer with Allowing parameterized property in C# (explicitly naming the indexer) gives more clear semantics. Static named indexer is supported in VB and IL, but cannot be represented in C#. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Previous discussion: #526. |
Beta Was this translation helpful? Give feedback.
0 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.
Uh oh!
There was an error while loading. Please reload this page.
-
This is just a convenience and I can easily work around this, but it cleans up the code a bit.
Basically it arises from situations where I collect all initiations of a given type into a list, then want to index it.
It's an oversimplified example. And it can already be worked around via
public static T Get(int i)
orpublic static void Set(int i, T value)
methods. But a minor suggestion that helps in some contexts.Usage
I know it looks ridiculous given the way the indexer is defined via a this statement and all, but it's a suggestion. Maybe the notation can be changed though, to something like:
Beta Was this translation helpful? Give feedback.
All reactions