views:

835

answers:

9

Sorry for the dumb question, but...

I'm moving from VB to C# and this is really bugging me. Is there a way to convince VS 2008 to draw a line separating my methods like it does for VB?

I'm really used to those, and i'm used to doing

//-------------------------------------------------------

myself in Javascript.

I'm hoping I won't have to do it manually in C# too.

Any pointers?
Thanks

+10  A: 

Not out of the box. There may be third-party apps which will do this like CodeRush or something like that.

But my advice: Get out of the habit of putting lines in between your procedures. Comments without meaning are evil.

Dave Markle
+1  A: 

Devexpress.com makes CodeRush, which has some visualizations.

RKitson
A: 

No. Believe me. I've looked.

Jekke
Check out pass_the_clock's answer -> CodeRush Xpress or DXCore + duncan smart's most excellent implementation of DrawLinesBetweenMethods :)
Rory Becker
+4  A: 

Why not add bona fide summary comments to methods? Any number of tools can create some form of documentation out of this.

Also the IDE can collapse the method so unsure of the gain of this line. Wouldn't #regions be of more interest? (rhetorical question)

VS10 will allow you WPF inline and so if you can wait you could even draw a sunset between two methods!

dove
I know what you're saying, but i'm really used to my line separators. They allow me to skim through the code REALLY fast. I look at a method's name, it's not what i'm looking for, I can very quickly jump to the next one. I haven't found any other way to do this as fast and efficiently.
Daniel Magliola
Have you noticed the method / class list dropdwon? Top right of the text editor window just below the toolbars. It shows you every method/variable in the file
Orion Edwards
+1 for Orion on the method drop down list. Just go directly to the method. No trouble in needing special comments to find methods.
Kibbee
+1  A: 

Or use #region to separate any regions of code. For example, I separate overrides, methods, properties, events and objects, but you could wrap your methods in #region to clearly separate each one (and collapse them when not in use.)

This isn't what you asked for, but it is a great alternative.

BBetances
Daniel Earwicker
A: 

This should easily be possible in Visual Studio 2010 due to the extensible, WPF-based text editor.

Andrew Peters
A: 

Not quite what you are looking for, but using Resharper it's possible to set up a custom type members template that would surround every method in a file/project/solution with a region whenever you pressed a shortcut.

Your other Resharper option would be to create a custom surround template, which would let you select a block of text and chose surround with->YourCustomSurround to place your comment block at the top.

Lawrence Johnston
+5  A: 

You can do this for free (assuming you are using Visual Studio 2008 Standard edition or higher).

Install the free CodeRush Xpress. Then install the free plugin DrawLinesBetweenMethods

Copy the DLL to this location - C:\Program Files\Developer Express Inc\DXCore for Visual Studio .NET\2.0\Bin\Plugins.

This will producethe effect described here: Lines between methods in the C# editor (CodeRush/DxCore plugin)

If you don't want CodeRush Xpress then an alternative is to install the free DXCore extensibility engine and then install the above plugin. If you install DXCore you are also able to make use of a number of other useful plugins, most of which can be found at the same site as DrawLinesBetweenMethods.

Kevin McFarlane
A: 

A note regarding your comment:

separators [...] allow me to skim through the code REALLY fast. [...] I can very quickly jump to the next [method].

What I see a lot, is that people forget about the two dropdown list at the top of the editor window (listing the classes of the current file and the class members of the current class). It allows navigating to class members very quickly.

M4N
If you are trying to find a specific method, yes.If you're trying to quickly get an overview of the whole file, no.
Daniel Magliola