- Find all references. Lists everywhere that a method or variable is used, including the definition. This is really useful when you're trying to work out where a variable is being assigned, or cleared. Right click a method or variable and select Find all references.
- Extract method. You've written a bunch of code that gets the job done but it's all inline. It looks horrible, and it's not reusable. Highlight all the code you'd like to break out into a new method, right click and select Extract method. Provide a method name and Visual Studio will create a method for you and even specify the parameters and return value!
- The Exceptions window. Press alt + ctrl + e to show this window. Not sure where exactly an exception is being thrown from? Check the Common Language Runtime option in this window and then execute the code.
- Call stack window. While debugging, lets you see at a glance the path of method calls that have been made to get you to your current point in the code. Double clicking a method in this window takes you to where the method was called, and let's you see the state of all the local variables. Really handy for debugging. Access through the Debug > Windows menu.
- Threads window. While debugging, lets you see how many threads you have executing. Double clicking a thread in this window takes you to its current point of execution in the code. Also accessed through the Debug > Windows menu.
- Automatic unit testing. Right click in your code and select Create unit tests... This brings up a dialog that lets you pick which methods to write unit tests for. Visual Studio will then generate a basic unit test for every method you select.
- Record/play macro. So you need to perform a repetitive typing operation on your code. Hit shift + ctrl + r to start recording a macro, perform the operation, and hit shift + ctrl + r again. Now every time you press shift + ctrl + p visual studio will perform your typing operation again!
That's probably enough to get a fresh faced youngster up to speed. I'm sure any old hands out there have plenty more to add to this list.
No comments:
Post a Comment