I work with a codebase where several classes implement an indexer:
public double this[int i, int j]
{
get { return ...; }
set { ...; }
}
When I stumble over code like foo[1,2] = 3
in visual Studio 2008, I frequently want to
right-click / "go to definition", i.e. show the above definition in the visual studio editor window.
For normal properties or methods this works without problems:foo.bar = 3
, right-click / "go to definition" takes me to the source code for foo.bar.
For overloaded +
or ==
this works as well.
However with the indexer this does not seem to work. Is there any way to accomplish this?
(I cannot even search for the string "this[" in the appropriate source file, since the same syntax may be used throughout the class to access the indexer. I always have to scroll trough all the methods and properties in the dropdown list for this file)
This doesn't really help with 2008 of course, but in 2010 and above they have "fixed" this with the Navigate To command (ctrl+, in the C# keyboard layout). Where you can enter this
to show a list of indexers in the current solution where you can double-click the one you want to navigate to.
+1 for Resharper which seems to work fine with pressing F12 when you caret is within an indexer usage.
You can install Resharper
who give you this functionality, Tool Box productivity don't give this functionality
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With