From c79de9fdd1d47bd0efe624a4ef6fe6e43517d5f2 Mon Sep 17 00:00:00 2001 From: "software9119.technology" Date: Thu, 17 Sep 2026 00:17:34 +0200 Subject: [PATCH 1/2] Example improvement --- docs/fundamentals/code-analysis/style-rules/ide0340.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/fundamentals/code-analysis/style-rules/ide0340.md b/docs/fundamentals/code-analysis/style-rules/ide0340.md index 9d8d37aabc262..c86882b88d56f 100644 --- a/docs/fundamentals/code-analysis/style-rules/ide0340.md +++ b/docs/fundamentals/code-analysis/style-rules/ide0340.md @@ -49,6 +49,11 @@ string name = nameof(List); string name = nameof(List<>); ``` +```csharp +// The resultant string output is the same for both options. +nameof(List) == nameof(List<>) // true +``` + ## Suppress a warning If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule. From 50878fcca2c29e27e159796f20638b262101e857 Mon Sep 17 00:00:00 2001 From: deeper-outcome Date: Tue, 22 Sep 2026 18:58:19 +0200 Subject: [PATCH 2/2] Copilot suggestion to example improvement Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/fundamentals/code-analysis/style-rules/ide0340.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/fundamentals/code-analysis/style-rules/ide0340.md b/docs/fundamentals/code-analysis/style-rules/ide0340.md index c86882b88d56f..acba52eef0f2c 100644 --- a/docs/fundamentals/code-analysis/style-rules/ide0340.md +++ b/docs/fundamentals/code-analysis/style-rules/ide0340.md @@ -50,8 +50,8 @@ string name = nameof(List<>); ``` ```csharp -// The resultant string output is the same for both options. -nameof(List) == nameof(List<>) // true +// Both operands produce the same string. +bool sameName = nameof(List) == nameof(List<>); // true ``` ## Suppress a warning