Short cut to format your code in Visual Studio

I’ve had occasion where I’m cutting and pasting code and it comes out in a nightmarish form in Visual Studio:

public class BlockAttributeJig : EntityJig
{
#region Fields 
private int mCurJigFactorNumber = 1;
private double mAngleOffset = 0.0;
private Point3d mPosition = new Point3d(0,0,0); // Factor #1
private double mRotation = 0.0;                 // Factor #2
private double mScaleFactor = 1.0;              // Factor #3
private Dictionary<AttributeReference, AttributeDefinition> mRef2DefMap;
#endregion
 #region Constructors
 public BlockAttributeJig(BlockReference ent, Dictionary<AttributeReference, AttributeDefinition> dict): base(ent)

Worry no more: Simply hit and the whole document is automatically indented. Amazing: Ctrl-K, Ctrl-D

        public class MoveRorationScaleJig : DrawJig
        {
            #region Fields

            Autodesk.AutoCAD.Geometry.Point3d mBase;

            private List<Entity> mEntities = new List<Entity>();

            private int mTotalJigFactorCount = 3;
            private int mCurJigFactorIndex = 1;  // Jig Factor Index

            public Autodesk.AutoCAD.Geometry.Point3d mLocation; // Jig Factor #1
            public Double mAngle; // Jig Factor #2
            public Double mScaleFactor; // Jig Factor #3
            #endregion

I found this video useful:

Hope this helps!

Written on December 2, 2016