using System.Collections.Generic;
public static void Main()
List<int> grades = new List<int>() {99,85, 70, 65, 55};
foreach (var item in grades)
var (grade, remarks) = item.GetGradeWithRemarks();
Console.WriteLine($"{item, -3}{grade,-3}{remarks}");
public static class Extensions
public static (string grade, string remarks) GetGradeWithRemarks(this int score) => score switch
>= 90 => ("A", "Great job"),
>= 80 and < 90 => ("B", "Good"),
>= 70 and < 80 => ("C", "Okay"),
>= 60 and < 70 => ("D", "Better study"),
>= 50 and < 60 => ("F", "You failed"),
_ => throw new ArgumentOutOfRangeException(
nameof(score), score, "Unexpected value")