#region

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Hello!

Below I have manually added the two statement #region Using directives and
#endregion.
I wonder if this possible to have the Visual studio 2005 to generate these
two statement for those statement
that should be included in this section.

#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.IO;

#endregion

//Tony
 
Well, you can select them, right-click, surround-with, #region - but I
suspect it is easier to just type #region ;-p

It wouldn't hugely surprise me if ReSharper can do this - it tends to
have much more refactoring / code [layout] automation features (but I
don't have ReSharper, so I can't check).

Marc
 
I think there may also be a method to change your default class template
that would statically contain such things. Never had the time to explore it
however.
--wjs
 
Hello!

Below I have manually added the two statement #region Using directives and
#endregion.
I wonder if this possible to have the Visual studio 2005 to generate these
two statement for those statement
that should be included in this section.

#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.IO;

#endregion

As a workaround, write a macros that does it, and bind it on some
convenient key - so that you can do it for every newly created file
with a single keypress.
 
I think there may also be a method to change your default class template
that would statically contain such things. Never had the time to explore it
however.

I am using visual studio express 2008 item templates are stored at:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VCSExpress
\ItemTemplatesCache\1033

You can edit these files, restart Visual Studio and then when you add
an item to the project it will default contain the region info.

Project templates are stored separately so you would have to edit all
of the item files within the project template separately.
They are at:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VCSExpress
\ProjectTemplatesCache\1033

NOTE: make shore you back up the directory before editing, you wont
find no undo button there ):

NOTE: VS 2005 the paths will be slightly different. I am shore you can
work them out.

Jay Dee
 
Back
Top