From 8608e860376dd90d8259af260ff7e158d7136ddb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:19:29 +0000 Subject: [PATCH 1/6] Initial plan From 97941ad7813e57228540a78655092235ee5f079c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:22:24 +0000 Subject: [PATCH 2/6] Clarify private constants use PascalCase; fix public field casing in const snippet --- .../coding-style/identifier-names.md | 19 +++++++++++++++---- .../snippets/csrefKeywordsModifiers.cs | 12 ++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/docs/csharp/fundamentals/coding-style/identifier-names.md b/docs/csharp/fundamentals/coding-style/identifier-names.md index b5dd421dad868..0b52e3d0403f2 100644 --- a/docs/csharp/fundamentals/coding-style/identifier-names.md +++ b/docs/csharp/fundamentals/coding-style/identifier-names.md @@ -37,9 +37,9 @@ By convention, C# programs use `PascalCase` for type names, namespaces, and all - Use meaningful and descriptive names for variables, methods, and classes. - Prefer clarity over brevity. - Use PascalCase for class names and method names. -- Use camelCase for method arguments, local variables, and private fields. -- Use PascalCase for constant names, both fields and local constants. -- Private instance fields start with an underscore (`_`). +- Use camelCase for method arguments, local variables, and private non-constant fields. +- Use PascalCase for constant names, both fields and local constants. This convention applies to all access modifiers; private constants also use PascalCase, not the `_camelCase` prefix used for private non-constant fields. +- Private instance fields start with an underscore (`_`). This prefix doesn't apply to private constants. - Static fields start with `s_`. This convention isn't the default Visual Studio behavior, nor part of the [Framework design guidelines](../../../standard/design-guidelines/names-of-type-members.md#names-of-fields), but is [configurable in editorconfig](../../../fundamentals/code-analysis/style-rules/naming-rules.md). - Avoid using abbreviations or acronyms in names, except for widely known and accepted abbreviations. - Use meaningful and descriptive namespaces that follow the reverse domain name notation. @@ -130,7 +130,18 @@ For more information on positional records, see [Positional syntax for property ### Camel case -Use camel casing ("camelCasing") when naming `private` or `internal` fields and prefix them with `_`. Use camel casing when naming local variables, including instances of a delegate type. +Use camel casing ("camelCasing") when naming `private` or `internal` non-constant fields, and prefix them with `_`. Use camel casing when naming local variables, including instances of a delegate type. + +> [!NOTE] +> Constants are an exception. Even `private` and `internal` constants use PascalCase, not `_camelCase`. For example: +> +> ```csharp +> public class DataService +> { +> private const int MaxRetryCount = 3; // PascalCase for constants +> private IWorkerQueue _workerQueue; // _camelCase for non-constant fields +> } +> ``` ```csharp public class DataService diff --git a/docs/csharp/language-reference/keywords/snippets/csrefKeywordsModifiers.cs b/docs/csharp/language-reference/keywords/snippets/csrefKeywordsModifiers.cs index 7c058a3e6ab73..e1bb160af7fe5 100644 --- a/docs/csharp/language-reference/keywords/snippets/csrefKeywordsModifiers.cs +++ b/docs/csharp/language-reference/keywords/snippets/csrefKeywordsModifiers.cs @@ -177,27 +177,27 @@ public class ConstTest { class SampleClass { - public int x; - public int y; + public int X; + public int Y; public const int C1 = 5; public const int C2 = C1 + 5; public SampleClass(int p1, int p2) { - x = p1; - y = p2; + X = p1; + Y = p2; } } static void Main() { var mC = new SampleClass(11, 22); - Console.WriteLine($"x = {mC.x}, y = {mC.y}"); + Console.WriteLine($"X = {mC.X}, Y = {mC.Y}"); Console.WriteLine($"C1 = {SampleClass.C1}, C2 = {SampleClass.C2}"); } } /* Output - x = 11, y = 22 + X = 11, Y = 22 C1 = 5, C2 = 10 */ // From fdd90b3c23b6deae06ff463107fb4b9643e5f7a3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:23:06 +0000 Subject: [PATCH 3/6] Address code review feedback: improve sentence clarity and phrasing --- docs/csharp/fundamentals/coding-style/identifier-names.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/csharp/fundamentals/coding-style/identifier-names.md b/docs/csharp/fundamentals/coding-style/identifier-names.md index 0b52e3d0403f2..bf8a69a1a7f67 100644 --- a/docs/csharp/fundamentals/coding-style/identifier-names.md +++ b/docs/csharp/fundamentals/coding-style/identifier-names.md @@ -38,8 +38,8 @@ By convention, C# programs use `PascalCase` for type names, namespaces, and all - Prefer clarity over brevity. - Use PascalCase for class names and method names. - Use camelCase for method arguments, local variables, and private non-constant fields. -- Use PascalCase for constant names, both fields and local constants. This convention applies to all access modifiers; private constants also use PascalCase, not the `_camelCase` prefix used for private non-constant fields. -- Private instance fields start with an underscore (`_`). This prefix doesn't apply to private constants. +- Use PascalCase for constant names, both fields and local constants. This convention applies to all access modifiers, including private constants, which don't use the `_camelCase` prefix applied to private non-constant fields. +- Private instance fields start with an underscore (`_`), but this prefix doesn't apply to private constants. - Static fields start with `s_`. This convention isn't the default Visual Studio behavior, nor part of the [Framework design guidelines](../../../standard/design-guidelines/names-of-type-members.md#names-of-fields), but is [configurable in editorconfig](../../../fundamentals/code-analysis/style-rules/naming-rules.md). - Avoid using abbreviations or acronyms in names, except for widely known and accepted abbreviations. - Use meaningful and descriptive namespaces that follow the reverse domain name notation. @@ -133,7 +133,7 @@ For more information on positional records, see [Positional syntax for property Use camel casing ("camelCasing") when naming `private` or `internal` non-constant fields, and prefix them with `_`. Use camel casing when naming local variables, including instances of a delegate type. > [!NOTE] -> Constants are an exception. Even `private` and `internal` constants use PascalCase, not `_camelCase`. For example: +> Because constants follow different naming conventions, even `private` and `internal` constants use PascalCase, not `_camelCase`. For example: > > ```csharp > public class DataService From 81776cbf1aa43ce60cbd2069046f81929b7af6a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:23:57 +0000 Subject: [PATCH 4/6] Refine wording per code review: split bullet, update field description, rephrase NOTE --- docs/csharp/fundamentals/coding-style/identifier-names.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/csharp/fundamentals/coding-style/identifier-names.md b/docs/csharp/fundamentals/coding-style/identifier-names.md index bf8a69a1a7f67..0d02075be82b2 100644 --- a/docs/csharp/fundamentals/coding-style/identifier-names.md +++ b/docs/csharp/fundamentals/coding-style/identifier-names.md @@ -38,8 +38,8 @@ By convention, C# programs use `PascalCase` for type names, namespaces, and all - Prefer clarity over brevity. - Use PascalCase for class names and method names. - Use camelCase for method arguments, local variables, and private non-constant fields. -- Use PascalCase for constant names, both fields and local constants. This convention applies to all access modifiers, including private constants, which don't use the `_camelCase` prefix applied to private non-constant fields. -- Private instance fields start with an underscore (`_`), but this prefix doesn't apply to private constants. +- Use PascalCase for constant names, both fields and local constants. This convention applies to all access modifiers, including `private` and `internal`. +- Private non-constant instance fields start with an underscore (`_`). - Static fields start with `s_`. This convention isn't the default Visual Studio behavior, nor part of the [Framework design guidelines](../../../standard/design-guidelines/names-of-type-members.md#names-of-fields), but is [configurable in editorconfig](../../../fundamentals/code-analysis/style-rules/naming-rules.md). - Avoid using abbreviations or acronyms in names, except for widely known and accepted abbreviations. - Use meaningful and descriptive namespaces that follow the reverse domain name notation. @@ -133,7 +133,7 @@ For more information on positional records, see [Positional syntax for property Use camel casing ("camelCasing") when naming `private` or `internal` non-constant fields, and prefix them with `_`. Use camel casing when naming local variables, including instances of a delegate type. > [!NOTE] -> Because constants follow different naming conventions, even `private` and `internal` constants use PascalCase, not `_camelCase`. For example: +> To maintain consistency with constant naming conventions, `private` and `internal` constants use PascalCase, not `_camelCase`. For example: > > ```csharp > public class DataService From d0d8c029b901ef24e229a4644266f9f53fb60f23 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:24:35 +0000 Subject: [PATCH 5/6] Lead bullets and NOTE with key information per style guide feedback --- docs/csharp/fundamentals/coding-style/identifier-names.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/csharp/fundamentals/coding-style/identifier-names.md b/docs/csharp/fundamentals/coding-style/identifier-names.md index 0d02075be82b2..5c3f9d522fd60 100644 --- a/docs/csharp/fundamentals/coding-style/identifier-names.md +++ b/docs/csharp/fundamentals/coding-style/identifier-names.md @@ -38,7 +38,7 @@ By convention, C# programs use `PascalCase` for type names, namespaces, and all - Prefer clarity over brevity. - Use PascalCase for class names and method names. - Use camelCase for method arguments, local variables, and private non-constant fields. -- Use PascalCase for constant names, both fields and local constants. This convention applies to all access modifiers, including `private` and `internal`. +- To maintain consistency across all access modifiers, use PascalCase for constant names, both fields and local constants, including `private` and `internal` constants. - Private non-constant instance fields start with an underscore (`_`). - Static fields start with `s_`. This convention isn't the default Visual Studio behavior, nor part of the [Framework design guidelines](../../../standard/design-guidelines/names-of-type-members.md#names-of-fields), but is [configurable in editorconfig](../../../fundamentals/code-analysis/style-rules/naming-rules.md). - Avoid using abbreviations or acronyms in names, except for widely known and accepted abbreviations. @@ -133,7 +133,7 @@ For more information on positional records, see [Positional syntax for property Use camel casing ("camelCasing") when naming `private` or `internal` non-constant fields, and prefix them with `_`. Use camel casing when naming local variables, including instances of a delegate type. > [!NOTE] -> To maintain consistency with constant naming conventions, `private` and `internal` constants use PascalCase, not `_camelCase`. For example: +> Private and internal constants use PascalCase (not `_camelCase`) to maintain consistency with constant naming conventions. For example: > > ```csharp > public class DataService From 7e8ba964ac6030ce3b26b41b1cdfea924dc8075e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:32:54 +0000 Subject: [PATCH 6/6] Move 'Private non-constant' bullet next to other non-constant bullet --- docs/csharp/fundamentals/coding-style/identifier-names.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/fundamentals/coding-style/identifier-names.md b/docs/csharp/fundamentals/coding-style/identifier-names.md index 5c3f9d522fd60..7290527f4c57c 100644 --- a/docs/csharp/fundamentals/coding-style/identifier-names.md +++ b/docs/csharp/fundamentals/coding-style/identifier-names.md @@ -38,8 +38,8 @@ By convention, C# programs use `PascalCase` for type names, namespaces, and all - Prefer clarity over brevity. - Use PascalCase for class names and method names. - Use camelCase for method arguments, local variables, and private non-constant fields. -- To maintain consistency across all access modifiers, use PascalCase for constant names, both fields and local constants, including `private` and `internal` constants. - Private non-constant instance fields start with an underscore (`_`). +- To maintain consistency across all access modifiers, use PascalCase for constant names, both fields and local constants, including `private` and `internal` constants. - Static fields start with `s_`. This convention isn't the default Visual Studio behavior, nor part of the [Framework design guidelines](../../../standard/design-guidelines/names-of-type-members.md#names-of-fields), but is [configurable in editorconfig](../../../fundamentals/code-analysis/style-rules/naming-rules.md). - Avoid using abbreviations or acronyms in names, except for widely known and accepted abbreviations. - Use meaningful and descriptive namespaces that follow the reverse domain name notation.