Search code examples
c#.netrefactoringnaming-conventionsstylecop

Variable names must not start with 'm_' : StyleCop Rule 1308 - Why is it considered a bad (or not good/standard) practice?


I have started using the StyleCop and it gives warning wherever there is a variable declared like m_VariableName.

The warning message is : Variable names must not start with 'm_'. This is StyleCop rule SA1308.

I can turn this rule off. But

1) I would like to know why is it a bad practice or considered to be a bad practice to declare variable names starting with 'm_'?

2) Does the underscore character has a special meaning for Visual Studio refactoring? (I heard it from one of the senior developers.)


Solution

  • The default StyleCop rules follow the Microsoft C# coding style.

    These include not using m_ as a prefix (seen as Hungarian Notation).

    If your team does not follow these style guidelines and has your own, feel free to switch the rule off.