Skip to content

Last example in Enumeration extension methods article is missing some output #55626

Description

@wk-bd

Type of issue

Missing information

Description

The last example in the article (see below) is missing some output. The line Console.WriteLine($"\r\nRaising the bar. Passing grade is now {Grades.MinimumPassingGrade}!\r\n"); should print "Raising the bar. Passing grade is now C!"

Grades g1 = Grades.D;
Grades g2 = Grades.F;
Console.WriteLine($"First {(g1.Passing ? "is" : "is not")} a passing grade.");
Console.WriteLine($"Second {(g2.Passing ? "is" : "is not")} a passing grade.");

Grades.MinimumPassingGrade = Grades.C;
Console.WriteLine($"\r\nRaising the bar. Passing grade is now {Grades.MinimumPassingGrade}!\r\n");
Console.WriteLine($"First {(g1.Passing ? "is" : "is not")} a passing grade.");
Console.WriteLine($"Second {(g2.Passing ? "is" : "is not")} a passing grade.");
/* Output:
    First is a passing grade.
    Second is not a passing grade.

    Raising the bar!

    First is not a passing grade.
    Second is not a passing grade.
*/

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/how-to-create-a-new-method-for-an-enumeration

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/programming-guide/classes-and-structs/how-to-create-a-new-method-for-an-enumeration.md

Document Version Independent Id

c91f6ad0-fbf0-c8b8-bafb-2083073d8ebf

Platform Id

b4ea3161-597b-f2d8-cd24-b6bd2a87a7f7

Article author

@BillWagner

Metadata

  • ID: 190b80d1-86d2-1640-da1a-72c45fa529a4
  • PlatformId: b4ea3161-597b-f2d8-cd24-b6bd2a87a7f7
  • Service: dotnet-csharp
  • Sub-service: fundamentals

Related Issues

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions