Just about everything in C# should be named in Pascal Case. (Example: MyDogHasFleas) There are three exceptions:
- Private variables that exist only within a loop or a method (almost all private variables) should be in Camel Case. (Example: myDogHasFleas)
- The exception to this exception is that private fields, that is controller or page wide variables that hold state from method to method, should be in Camel Case with a leading underscore. (Example: _myDogHasFleas)
- Strictly speaking one should never use underscores in names in any scenario other than the one above. One should never have underscores in the middle of name. That said, when I worked at AMD, I liked Joel Holder's convention of using snake case for the names of tests. This is a Ruby convention that he drug in. (Example: my_dog_has_fleas)
No comments:
Post a Comment