From c7bbf18700d0240d1e4cdf421802a29a7684354d Mon Sep 17 00:00:00 2001 From: OJacot-Descombes Date: Wed, 27 Feb 2019 22:35:07 +0100 Subject: [PATCH] Update C# Coding Standards and Naming Conventions.md --- C# Coding Standards and Naming Conventions.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C# Coding Standards and Naming Conventions.md b/C# Coding Standards and Naming Conventions.md index 0d818d0..bb92d90 100644 --- a/C# Coding Standards and Naming Conventions.md +++ b/C# Coding Standards and Naming Conventions.md @@ -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).*** -#### 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 // Correct string firstName; int lastIndex; bool isSaved; +string commaSeparatedNames = String.Join(", ", names); +int index = Int32.Parse(input); // Avoid String firstName; Int32 lastIndex; 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.***