Skip to content

Commit

Permalink
updates for build
Browse files Browse the repository at this point in the history
  • Loading branch information
BillWagner committed Oct 2, 2024
1 parent b5e1dff commit f87034a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@ namespace EnumExtension
{
// Define an extension method in a non-nested static class.
public static class Extensions
{
public static Grades minPassing = Grades.D;
public static bool Passing(this Grades grade)
{
return grade >= minPassing;
public static Grades minPassing = Grades.D;
public static bool Passing(this Grades grade)
{
return grade >= minPassing;
}
}
}

public enum Grades { F = 0, D=1, C=2, B=3, A=4 };
class Program
{
static void Main(string[] args)
public enum Grades { F = 0, D=1, C=2, B=3, A=4 };
class Program
{
Grades g1 = Grades.D;
Grades g2 = Grades.F;
Console.WriteLine("First {0} a passing grade.", g1.Passing() ? "is" : "is not");
Console.WriteLine("Second {0} a passing grade.", g2.Passing() ? "is" : "is not");

Extensions.minPassing = Grades.C;
Console.WriteLine("\r\nRaising the bar!\r\n");
Console.WriteLine("First {0} a passing grade.", g1.Passing() ? "is" : "is not");
Console.WriteLine("Second {0} a passing grade.", g2.Passing() ? "is" : "is not");
}
}
}
/* Output:
First is a passing grade.
Second is not a passing grade.
static void Main(string[] args)
{
Grades g1 = Grades.D;
Grades g2 = Grades.F;
Console.WriteLine("First {0} a passing grade.", g1.Passing() ? "is" : "is not");
Console.WriteLine("Second {0} a passing grade.", g2.Passing() ? "is" : "is not");

Extensions.minPassing = Grades.C;
Console.WriteLine("\r\nRaising the bar!\r\n");
Console.WriteLine("First {0} a passing grade.", g1.Passing() ? "is" : "is not");
Console.WriteLine("Second {0} a passing grade.", g2.Passing() ? "is" : "is not");
}
/* Output:
First is a passing grade.
Second is not a passing grade.
Raising the bar!
Raising the bar!
First is not a passing grade.
Second is not a passing grade.
*/
First is not a passing grade.
Second is not a passing grade.
*/
}
}
//</snippet2>
} //namespace Extension2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>ExtensionMethods</AssemblyName>
<StartupObject>Extension2.Program</StartupObject>
<StartupObject>Extension2.EnumExtension.Program</StartupObject>
</PropertyGroup>

</Project>

0 comments on commit f87034a

Please sign in to comment.