1 /******************************************************************************
2 Style Guidelines:
3 * Readability - code is easy to read and to understand
4 * Standardisation - all team members are aligned with same code style
5 * Self-descriptive code - code is easy to understand without comments
6 * Debuggable - code is easy to debug (IDE friendly)
7 ******************************************************************************/8 9 // types are defined within the scope of namespace10 // space name starts with Upper case letter11 // each following word starts with upper Case letter12 // sub-spaces are divided by '.' (dot)13 // here "MyNameSpace" is main space and "Structs" is sub-space14 namespace MyNameSpace.Structs15 { 16 /// <summary>17 /// type name starts with Upper case letter18 /// each following word starts with Upper Case letter19 /// <remarks>20 /// type = class, enum, struct, delegate. interface, etc21 /// </remarks>22 /// </summary>23 public struct MyStruct24 {25 /// <summary>26 /// static variable name starts with Upper case letter27 /// each following word starts with Upper case letter28 /// </summary>29 public static float MyStaticNumber = 100f;30 31 /// <summary>32 /// public variable name starts with Upper case letter33 /// each following word starts with Upper case letter34 /// </summary>35 public double MyNumber;36 37 /// <summary>38 /// public read-only variable name starts with Upper case letter39 /// each following word starts with Upper case letter40 /// </summary>41 public readonly bool IsInit;42 43 /// <summary>44 /// constructor name starts with Upper case letter45 /// each following word starts with Upper case letter46 /// </summary>47 /// <param name="myNumber">48 /// parameter name starts with lower case letter49 /// each following word starts with Upper case letter50 /// <remarks>51 /// NOTE pay attention to letter case difference between 'MyNumber' variable and 'myNumber' parameter52 /// </remarks>53 /// </param>54 public MyStruct(double myNumber)55 { // <- opening parenthesis, new line after method name56 MyNumber = myNumber;57 58 // function scope const variable name starts with lower case letter59 // each following word starts with Upper case letter60 // NOTE variable/const definition is close to it's usage scope 61 const bool isInit = true;62 IsInit = isInit;63 } // <- closing parenthesis, new line after last method code line64 }65 }