mirror of
https://github.com/Stone-Red-Code/naming-convention.git
synced 2026-09-04 00:56:16 +02:00
Merge pull request #13 from OJacot-Descombes/OJacot-Descombes-issue11
Update C# Coding Standards and Naming Conventions.md
This commit is contained in:
@@ -124,17 +124,21 @@ private DateTime _registrationDate;
|
|||||||
|
|
||||||
***Why: consistent with the Microsoft's .NET Framework and makes code more natural to read (without 'slur'). Also avoids underline stress (inability to see underline).***
|
***Why: consistent with the Microsoft's .NET Framework and makes code more natural to read (without 'slur'). Also avoids underline stress (inability to see underline).***
|
||||||
|
|
||||||
#### 9. Do use predefined type names instead of system type names like Int16, Single, UInt64, etc.
|
#### 9. Do use predefined type names (C# aliases) like `int`, `float`, `string` for local, parameter and member declarations. Do use .NET Framework names like `Int32`, `Single`, `String` when accessing the type's static members like `Int32.TryParse` or `String.Join`.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Correct
|
// Correct
|
||||||
string firstName;
|
string firstName;
|
||||||
int lastIndex;
|
int lastIndex;
|
||||||
bool isSaved;
|
bool isSaved;
|
||||||
|
string commaSeparatedNames = String.Join(", ", names);
|
||||||
|
int index = Int32.Parse(input);
|
||||||
// Avoid
|
// Avoid
|
||||||
String firstName;
|
String firstName;
|
||||||
Int32 lastIndex;
|
Int32 lastIndex;
|
||||||
Boolean isSaved;
|
Boolean isSaved;
|
||||||
|
string commaSeparatedNames = string.Join(", ", names);
|
||||||
|
int index = int.Parse(input);
|
||||||
```
|
```
|
||||||
|
|
||||||
***Why: consistent with the Microsoft's .NET Framework and makes code more natural to read.***
|
***Why: consistent with the Microsoft's .NET Framework and makes code more natural to read.***
|
||||||
|
|||||||
Reference in New Issue
Block a user