0

Let's get the duplication allegation out of the way.

I saw couple of variations of this question, notably, link. However, it doesn't address issue specific to C# developers. I want to collect a list most used/powerful/cool tricks--tips in VS from people who are using C# under visual studio 2005 (it's ok to mention for 2008 as well). Below are the links that I have used as a guide:

msdn <-- our guys from Microsoft have a tip or two to share

Kirill's Visual Studio Tips <-- This blog also has couple of good links

Debugging tips are also encouraged

Thank for sharing your tips and increasing my productivity :)

Some of my arsenal:

  • Ctrl+-, Ctrl++, navigates back and forward where you've been recently

  • Ctrl+Shift+V, which will cycle through your clipboard history

  • F12 to go to definition of variable.

  • Ctrl+K, Ctrl+C to comment a block of text with // at the start

  • Ctrl-K, Ctrl-U to uncomment a block of text with // at the start

  • Ctrl+/ to get to the find box.

  • Ctrl+I for incremental search, F3 to iterate

  • Select an expression/variable in debug mode and type Ctrl+D, Ctrl+Q to open the quick watch window.

Community
  • 1
  • 1

7 Answers7

4

Here is a site I just found last week http://scottcate.com/tricks/

The #1 tip I have is go buy Resharper!

abombss
  • 476
  • 4
  • 7
  • I came to C# from Java, and Resharper adds almost everything I miss from IDEa – Matt Briggs Feb 23 '09 at 19:08
  • what does it add? I don't want to pay for extra tricks unless they are REALLY worthwhile and mandatory to have –  Feb 23 '09 at 19:12
  • This video (http://www.jetbrains.com/resharper/documentation/presentation/codingSession/CodingSession.wmv) is a pretty good illustration of the sorts of things you can do with Resharper if you know how to use it. And it doesn't even address Resharper's invaluable code-quality features. – Robert Rossney Feb 23 '09 at 19:40
  • it seems to gain lots of support...greatzzz –  Feb 23 '09 at 20:29
  • It adds refactoring support, navigation, code analysis, and auto-completion, plus really nice custom templates. I recently had to dev something without R# and I can't believe how long it took me! Simple things like extracting interfaces, changing signatures, and renaming are so nice with R#! – abombss Feb 23 '09 at 20:51
2

One of my favorite Snippets is the one for enums.

Say you have this code:

private void DoSomethingForToday(DayOfWeek today)
{
   //in here you want to do something different depending on which day it is, so you need a switch/case
   //you type switch, hit tab twice, you'll get this:

            switch (switch_on) //switch_on will be highlighted, replace it with "today" and hit enter. It will automatically fill in all the possible enum values with case statements.
            {
                default:
            }    
}
BFree
  • 102,548
  • 21
  • 159
  • 201
1

The tab key for "snippets"

e.g. type 'try' and then hit the tab key twice.

Results in:

try 
{           

}
catch (Exception)
{

    throw;
}

which you can then expand.

Andrew Hare
  • 344,730
  • 71
  • 640
  • 635
rbrayb
  • 46,440
  • 34
  • 114
  • 174
  • 1
    yep... I love this one, works for for lopps, if statements, etc... –  Feb 23 '09 at 19:11
1

CTRL +ALT + P to attach a process,

Oscar Cabrero
  • 4,168
  • 8
  • 29
  • 49
0

Ctrl-W, Ctrl-A -> to focus on the immediate window (the window itself is underused IMO).
of (filename) in the immediate window to open a file. You get nice path/name completion amongst all files in the solution.
Ctrl-W, Ctrl-S -> to foucs on the solution explorer.
Select an expression/variable in debug mode and type Ctrl-D,Ctrl-Q to open the quick watch window.

Mohit Chakraborty
  • 1,253
  • 8
  • 8
0

See here at StackOverFlow.

Don't let the url fool you: the 'friendly' url strips off the # symbol. This is the #3 highest voted question on StackOverflow, BTW, so it's not like it was exactly hidden.

Community
  • 1
  • 1
Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
0

Have you seen this blog... and the book "Microsoft Visual Studio Tips" that came from it?

Richard
  • 106,783
  • 21
  • 203
  • 265