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
- Did you know - Zip is built into .NET? - August 21st, 2008
- Automatic Implementation of Interfaces - October 1st, 2008
- Easily Find Classes, Methods, and Variables - November 17th, 2008
- Advantages of Using Class Diagram - November 20th, 2008
- Panel DefaultButton does not work - December 25th, 2012
- Finding a CSS Class Definition - May 29th, 2013
- Renaming Properties, Methods and Variables - November 13th, 2013
- Effective Hacks to Enhance IT Careers of College Students - September 3rd, 2015