简体   繁体   中英

How do I change the recommended C# variable naming convention?

I've been naming private member variables (especially those that are backing fields for properties) with a leading underscore forever. VS 2012 is a little gripey about this though.

Ex:

private int _MyVal;
public int MyVal 
{
  get { return _MyVal;}
  set { _MyVal = value;}
}

How do I get VS2012 to quit it's Kvetching or even better actively suggest my preferred naming convention? (Of note, I obviously don't want to do this for method parameters, public fields or members as AFAIK that does not conform to the .net calling conventions.)

I'll simply direct you to this other question: C# Coding Standards Tool

To sum up it suggests, StyleCop, Resharper and FxCop among other things.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM