ciriarte
ciriarte

Reputation: 1483

Is there a way to instruct visual studio to auto add fields at the bottom of the class instead of the top?

namespace Guilds
{
  public class Wizard
  {
    public void Wear(IClothing clothing)
    {
      Console.WriteLine("Puts on the {Robe} and {WizardHat}".Fmt(clothing));
    }

    IClothing _clothes;
    IWeapon   _weapon; // <== I want my fields added at the bottom of the class!
  }
}

I am aware that if you put your fields at the bottom, it will start adding subsequent ones to the bottom of the class as well. I would love to have this as the default behavior even for the first field.

This behavior is usually triggered when pressing Ctrl + . on top of an undeclared field.

Upvotes: 2

Views: 158

Answers (1)

Vijay Gill
Vijay Gill

Reputation: 1518

Use Regionerate and create your own format template. it's free tool to use with visual studio.

Edit: You can also use CodeMaid because it seems that Regionerate and VS2012 do not work together (I have not tested that combination at all though. I have VS2010)

Edit Adding more to my previous reply. CodeMaid is really cool and you can specify the layout in configuration. Also in configuration, you can specify that file should be formatted on save. This way write your code in anyway you want and have it formatted when you press Ctrl+S! I am one happy user of CodeMaid. Also I am using Visual Studio 2013.

Upvotes: 4

Related Questions