0

Now I structure my C# class files in regions:

**

  1. Property region
  2. Field region
  3. Constructor region
  4. Method region

**

Is there anyway to create a custom Class template which includes my regions (and another formatting) automatically when I press Add New Item -> Class... so I can save time?

enter image description here

I'm using Visual Studio 2013 Ultimate.

garfbradaz
  • 3,424
  • 7
  • 43
  • 70

1 Answers1

1

You could edit the Visual Studio C# class template:

using System;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$
using System.Text;
$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;
$endif$
namespace $rootnamespace$
{
    public class $safeitemrootname$
    {
        #region Properties
        #endregion Properties
        #region Fields
        #endregion Fields
        #region Constructors
        #endregion Constructors
        #region Methods
        #endregion Methods
    }
}

You can see the location of them in this answer.

Community
  • 1
  • 1
Jyrka98
  • 530
  • 1
  • 10
  • 19