Easily Find Classes, Methods, and Variables

I02B0065 There is a bit of a “trick” that I use routinely in visual studio to help me find the definition of Classes, Methods, and Variables in my solution regardless.

This “trick” works in both csharp and in VB.NET and, if you don’t know it already, will save you a ton of time.

If you want to know the type of a variable, obviously all you need to do is hover your mouse over it, but if you want to know the definition of the class that your variable is defined as, what do you do?

My bet is that many of you are searching for the class in the solution explorer.

Instead, you can do this:

  • Right click on the variable name.
  • Select “Go To Definition”  from the resulting context menu.
  • This will place you on the variable declaration line.
  • Right-click the class name on the variable declaration line.
  • Select “Go To Definition” from the resulting context menu (no, this is not a type-o.  Do it a second time).
  • You will now be at the class.

This works even if the method is in the .NET library and you don’t have the code for it.  It will simply bring up as much of the class definition as it can reflect.  That is, you’ll see the class name, methods, and properties, but you won’t see the code that actually makes it all work.

 

Other post in Did you know

Related Post

Comments are closed.