From ec0937265e4935b9ff3c48ae9c32f9877819c8c3 Mon Sep 17 00:00:00 2001 From: Ervis Date: Sun, 23 Aug 2026 08:51:33 -0600 Subject: [PATCH] Enhance documentation on enum extension methods Added the missing output line "Raising the bar. Passing grade is now C!" to the final example in the article. This resolves issue #55626. --- .../how-to-create-a-new-method-for-an-enumeration.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/csharp/programming-guide/classes-and-structs/how-to-create-a-new-method-for-an-enumeration.md b/docs/csharp/programming-guide/classes-and-structs/how-to-create-a-new-method-for-an-enumeration.md index 1353e1451c036..29404475bd118 100644 --- a/docs/csharp/programming-guide/classes-and-structs/how-to-create-a-new-method-for-an-enumeration.md +++ b/docs/csharp/programming-guide/classes-and-structs/how-to-create-a-new-method-for-an-enumeration.md @@ -18,6 +18,16 @@ You can call the extension method as though it was declared on the `enum` type: :::code language="csharp" source="./snippets/ExtensionMembers/CustomExtensionMethods.cs" id="ExampleExtendEnum"::: +:::output +First is a passing grade. +Second is not a passing grade. + +Raising the bar. Passing grade is now C! + +First is not a passing grade. +Second is not a passing grade. +::: + Beginning with C# 14, you can declare *extension members* in an extension block. The new syntax enables you to add *extension properties*. You can also add extension members that appear to be new static methods or properties. You're no longer limited to extensions that appear to be instance methods. The following example shows an extension block that adds an instance extension property for `Passing`, and a static extension property for `MinimumPassingGrade`: :::code language="csharp" source="./snippets/ExtensionMembers/CustomExtensionMembers.cs" id="EnumExtensionMembers":::