Naming Convention

link - learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions


Camal Notation

Initial lowercase for variable names
This is when the first character of each word is a capital, except the first word.
For example: myCounter, numberOfDays, foreColor

string variableName; 
object variableName;

'VB.Net Equivalent
Dim variableName As String
Dim variableName As Object

Use camel casing ("camelCasing") when naming private or internal fields
When writing method parameters, use camel casing.



Pascal Notation

Initial uppercase for variable names
This is when the first character of each word is a capital.
For example: MyCounter, NumberOfDays, ForeColor

string VariableName; 
object VariableName;

'VB.Net Equivalent
Dim VariableName As String
Dim VariableName As Object

Use pascal casing ("PascalCasing") when naming a class, record, or struct.
When naming an interface, use pascal casing in addition to prefixing the name with an I.
When naming public members of types, such as fields, properties, events, methods, and local functions, use pascal casing.
When writing positional records, use pascal casing for parameters as they're the public properties of the record.
link - learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/record#positional-syntax-for-property-definition



Hungarian Notation

This is defined as a set of characters that are added to the start of variable names to indicate their data type.
For example: iMyCounter, iNumberOfDays, oForeColor
This notation is used in VBA but not in C# or VB.Net

string sVariableName; 
object oVariableName;

'VB.Net Equivalent
Dim sVariableName As String
Dim oVariableName As Object

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext