⇤ ← Revision 1 as of 2023-02-23 16:35:46
Size: 1397
Comment:
|
Size: 1508
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 11: | Line 11: |
All of these are meant to be publicly visible to classes in the assembly, therefore they use the same style: PascalCase. | All of these are meant to be publicly visible to classes in the assembly, therefore they use the same style: PascalCase. IF HOWEVER, you are using a variable name that is the same as the class name/enum name/... then use CamelCase. |
Coding Style in C#
Because we don't have a style for Dr. A that isn't C# ;-O
Variable Names
ALWAYS!!! Use meaningful names! Its fine to use x as a int for a loop, but otherwise your variable names should be descriptive enough for any programmer to infer its purpose.
Public, Protected and Internal
All of these are meant to be publicly visible to classes in the assembly, therefore they use the same style: PascalCase. IF HOWEVER, you are using a variable name that is the same as the class name/enum name/... then use CamelCase.
E.g. HelloWorld
Private
All of these are meant to be visible only inside the class they are defined and should be prefixed with an underscore and be in CamelCase.
E.g. _helloWorld
Private static
Prefix the _ with the letter s.
E.g. s_helloWorld.
Caveat: Dr. A doesn't mind if you are doing public static readonly values that are assigned at definition to be all caps with words separated by underscores.
E.g. public static readonly string HELLO_WORLD = "Hello world";
Comments
Please place a space after the // or