diff --git a/docs/csharp/programming-guide/inside-a-program/coding-conventions.md b/docs/csharp/programming-guide/inside-a-program/coding-conventions.md index 2f76934efd594..1405d8907c9b1 100644 --- a/docs/csharp/programming-guide/inside-a-program/coding-conventions.md +++ b/docs/csharp/programming-guide/inside-a-program/coding-conventions.md @@ -1,7 +1,7 @@ --- title: "C# Coding Conventions - C# Programming Guide" description: Learn about coding conventions in C#. Coding conventions create a consistent look to the code and facilitate copying, changing, and maintaining the code. -ms.date: 05/05/2021 +ms.date: 05/14/2021 helpviewer_keywords: - "coding conventions, C#" - "Visual C#, coding conventions" @@ -19,7 +19,8 @@ Coding conventions serve the following purposes: > - They facilitate copying, changing, and maintaining the code. > - They demonstrate C# best practices. -The guidelines in this article are used by Microsoft to develop samples and documentation. +> [!IMPORTANT] +> The guidelines in this article are used by Microsoft to develop samples and documentation. They were adopted from the [.NET Runtime, C# Coding Style](https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/coding-style.md) guidelines. You can use them, or adapt them to your needs. The primary objectives are consistency and readability within your project, team, organization, or company source code. ## Naming conventions @@ -27,7 +28,7 @@ There are several naming conventions to consider when writing C# code. ### Pascal case -You should use pascal casing ("PascalCasing") when naming a `class`, `record`, or `struct`. +Use pascal casing ("PascalCasing") when naming a `class`, `record`, or `struct`. ```csharp public class DataService @@ -57,7 +58,7 @@ public interface IWorkerQueue } ``` -When naming `public` members of types, such as; fields, properties, events, methods, and local functions use pascal casing. +When naming `public` members of types, such as fields, properties, events, methods, and local functions, use pascal casing. ```csharp public class ExampleEvents @@ -81,7 +82,7 @@ public class ExampleEvents } ``` -When writing positional-records, use pascal casing for parameters as they're the public properties of the record. +When writing positional records, use pascal casing for parameters as they're the public properties of the record. ```csharp public record PhysicalAddress( @@ -91,11 +92,11 @@ public record PhysicalAddress( string ZipCode); ``` -For more information on positional-records, see [Positional syntax for property definition](../../language-reference/builtin-types/record.md#positional-syntax-for-property-definition). +For more information on positional records, see [Positional syntax for property definition](../../language-reference/builtin-types/record.md#positional-syntax-for-property-definition). ### Camel case -You should use camel casing ("camelCasing") when naming `private` or `internal` fields, and they should be prefixed with `_`. +Use camel casing ("camelCasing") when naming `private` or `internal` fields, and prefix them with `_`. ```csharp public class DataService