2

Is there a way to comment out a chunk of code quickly using CodeRush ?

        'For narCounter = 0 To UBound(arPDFFiles)
        '    'Add the PDF File Names to the Data Table.
        '    rowPDF = dtPDF.NewRow
        '    rowPDF("PDFDocument") = arPDFFiles(narCounter)
        '    dtPDF.Rows.Add(rowPDF)
        'Next
cometbill
  • 1,619
  • 7
  • 19
  • 41

4 Answers4

4

Yes, the CodeRush Pro has the Selection Comment feature. This feature adds the capability to quickly comment or uncomment a multi-line block of code (or any text in the code editor) via a single shortcut. In Visual Basic, it is (‘)(Apostrophe) and in CSharp (or C++), it is (/) (Slash). Note that if you are using CodeRush Xpress, it doesn't have this feature. Here is some more info on this.

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
  • 1
    Additionally it should be noted that if you are based using a uk keyboard the VB.Net binding is by default set to # rather than ' – Rory Becker Apr 07 '11 at 13:09
  • 1
    This is due to the way keybindings are stored. the US code for ' and the Uk code for # are apparently the same. – Rory Becker Apr 07 '11 at 13:10
2

Yes, this can be done using CodeRush. Select a code and press the ' button.

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
DevExpress Team
  • 11,338
  • 2
  • 24
  • 23
1

You can use Ctr+E, C which is already built into Visual Studio

Nils Magne Lunde
  • 1,794
  • 1
  • 13
  • 21
  • The CodeRush shortcut (') is easier, and a lot more intuitive. – cometbill Apr 07 '11 at 13:37
  • @cometbill: To a vb developer it might be more intuitive, but for a c# developer maybe not. To be honest I didn't know about that shortcut myself, and I use CodeRush quite a bit. – Nils Magne Lunde Apr 07 '11 at 14:26
  • The C# shortcut to the same feature is / (slash). This is the same key as used in making single line comments in c# itself. This allows the Learning curve to be very low in this area. – Rory Becker Apr 07 '11 at 15:19
  • I suspect @cometbill references the '(apostrophe) because he is a vb dev. His original question related to VB.net, but we've obviously considered c# devs in our implementation. – Rory Becker Apr 07 '11 at 15:20
  • Hey Ole_Brun could you contact me via email (roryb@devexpress.com) and I'll see if I can't find out what's wrong here. It's almost sounds like a VB user has been messing with your settings. :) – Rory Becker Apr 07 '11 at 15:41
0

Ctrl K + C in VS does this too.

John Batdorf
  • 2,502
  • 8
  • 35
  • 43