by Wojciech Sura

Visual Studio 2013 productivity tips

There are a few things you may not know, which can significantly boost your productivity in Visual Studio 2013.

You may access items named in PascalCase by simply writing word initials, like IOE for InvalidOperationException or IOException.


The quick way to open context menu on suggested change (like adding a class, method, renaming identifier etc.) is Ctrl+. (Ctrl + dot). If you remember, which item is default (such as renaming identifier), performing desired refactoring is as quick as pressing Ctrl+., Enter.


You can very quickly search for Visual Studio settings in the top-right field accessible quickly by Ctrl+Q.

Search settings

Visual Studio supports so called progressive search feature. Visually it looks almost identically to the Find dialog, but that dialog is closed immediately, when you finish searching (for instance, when you press the arrow key). Also, it does not fill the input box with what is currently under the cursor – instead it waits until you start typing. Shortcut for the progressive search is Ctrl+I. If you want to search for next occurrence, press F3.

Progressive search dialog:

Progressive search

Regular search dialog:

Regular search

There’s also another type of search, which seeks through all symbols and filenames in the solution. The shortcut for this one is Ctrl+, (Ctrl + comma).


If you work with a huge solution, you may narrow the view of Solution Explorer to specific branch by choosing “Scope to this” from the context menu. Use the home icon to return to the solution view again.

Solution explorer

There are also a few shortcut chords used more frequently than the others:

  • Ctrl+K, Ctrl+F – Auto-format selection
  • Ctrl+M, Ctrl+L – Fold all / Unfold all
  • Ctrl+M, Ctrl+M – Fold current block
  • Ctrl+M, Ctrl+O – Fold to definitions
  • Ctrl+K, Ctrl+K – Set bookmark in place of cursor
  • Ctrl+K, Ctrl+N – (like “Next”) – jump to next bookmark in the code
  • Ctrl+K, Ctrl+P – (like “Previous”) – jump to previous bookmark in the code
by Wojciech Sura

In operator in C#?

Most languages provides a very useful in operator, which tests, whether item is in specific collection, for instance, in Delphi:

if state in [State1, State2, State3] then Writeln("State 1-3!");

C# unfortunately lacks this operator, but we may cheat a little and reverse the condition:

if (new[] { MyStates.State1, MyStates.State2, MyStates.State3 }.Contains(state))
Console.WriteLine("State 1-3!");

It is decision of developer, whether this notation is clear enough. The alternative is either test different conditions:

if (state == MyStates.State1 || state == MyStates.State2 || state == MyStates.State3)
Console.WriteLine("State 1-3!");

Or you may store the required states in some temporary variable:

var states = new[] { MyStates.State1, MyStates.State2, MyStates.State3 };
if (states.Contains(state))
Console.WriteLine("State 1-3!");

The first option seems the most elegant to me though.