Monday, December 21, 2015

Code Refactors: Rename Privates Fields

Its feature is pretty self-explanatory, renaming class private fields.

If something like the following is written somewhere,

 class CodeTester_Fields { protected int intField; int intFieldWithValue = 123; public readonly int intFieldReadonlyWithValue = 456; public const int intFieldConst = 789; new int intFieldNew; private double doubleFieldWithValue = 123.456; public double doubleField; public static string stringFieldWithValue = "string field with value"; static string stringField; }

        all the fields selected, and the Rename Private Fields command is called up, the following dialog will show up:


If the new naming convention is specified as above and the OK button pressed, the fields will look like below:

 class CodeTester_Fields { protected int intField; int m_IntFieldWithValue = 123; public readonly int intFieldReadonlyWithValue = 456; public const int intFieldConst = 789; new int m_IntFieldNew; private double m_DoubleFieldWithValue = 123.456; public double doubleField; public static string stringFieldWithValue = "string field with value"; static string m_StringField; }

As seen, the command only takes care of private fields, local or static.

FREE Download and Try Visual Smarter 2015

No comments:

Post a Comment