Open carlreinke opened 6 years ago
Hmm, not sure how we could display an indexed property in C# syntax.
We could ignore the property and display the accessor methods instead (like the VS metadata view does), but then we're missing out on the property attributes.
Or we could display the parameter list somehow, maybe as a code comment:
new CodeElement CodeElement/*[vsCMElement]*/
Since indexers and indexed properties are almost the same thing in IL, maybe some variation of the syntax for indexers could work?
E.g.:
[DispId(51)]
[IndexerName("CodeElement)"]
public EnvDTE.CodeElement this[EnvDTE.vsCMElement Scope] /* indexed property */
{
[DispId(51)]
get;
}
Using indexer declaration syntax is not possible, because that would declare it as default property on recompilation. Also all use sites of the property would have to use indexer syntax, which does not really work... Currently method declaration syntax plus a comment adding the property attributes seems to be the only sensible way to solve this.
The navigation tree gives a good hint that it's an indexed property, but if you're using ILSpy inside Visual Studio then the tree doesn't show and you only get the the C# code, which doesn't have any indication.
Here's how it looks in ILSpy:
Here's how Visual Studio 2017 shows it with ILSpy turned off:
Here's how Visual Studio 2017 shows it with ILSpy turned on: