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

Suggestion: show indexer accesors as this[...].get instead of get_Item(...) #148

Open
jnm2 opened this issue Feb 25, 2021 · 0 comments
Open

Comments

@jnm2
Copy link

jnm2 commented Feb 25, 2021

Current:

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

   at TValue System.Collections.Generic.Dictionary<TKey, TValue>.get_Item(TKey key)

Proposed:

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

   at TValue System.Collections.Generic.Dictionary<TKey, TValue>.this[TKey key].get

If the property name matches the type's DefaultMemberAttribute (if it exists) or is "Item" (only if DefaultMemberAttribute does not exist), it is a default indexer and should be shown using the keyword this.
Otherwise, it is a non-default indexer which languages other than C# can declare but C# cannot, and it could be shown using its name instead of the keyword this or it could go back to its current behavior (get_NameOfNonDefaultIndexer) which matches the C# syntax you would use to actually call a non-default indexer from C# code.

The set/init accessor would be the same.

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

2 participants