using System.Collections.ObjectModel;
public static void Main()
TakingAnEnumeratedValueAsAParameter(SkillTypes.EntryLevel);
TakingAnEnumeratedValueAsAParameter(SkillTypes.Intermediate);
TakingAnEnumeratedValueAsAParameter(SkillTypes.Advanced);
foreach (SkillType skill in SkillTypes.All)
string meetsExpectations = skill.MeetsExpectations(SkillTypes.Intermediate) ? "meets" : "doesn't meet";
Console.WriteLine($"{skill} {meetsExpectations} {SkillTypes.Intermediate} expectations.");
public static void TakingAnEnumeratedValueAsAParameter(SkillType skill)
Console.WriteLine($"{skill} skill processed.", skill);
public string Name { get; init; }
public string Code { get; init; }
public int Trustworthiness { get; init; } = 0;
public bool MeetsExpectations(SkillType skill)
return this.Trustworthiness >= skill.Trustworthiness;
public override string ToString()
public static class SkillTypes
public static readonly SkillType EntryLevel = new SkillType { Name = "Entry Level", Code = "ENT", Trustworthiness = 1 };
public static readonly SkillType Intermediate = new SkillType { Name = "Intermediate", Code = "INT", Trustworthiness = 5 };
public static readonly SkillType Advanced = new SkillType { Name = "Advanced", Code = "ADV", Trustworthiness = 10};
public static readonly ReadOnlyCollection<SkillType> All = new ReadOnlyCollection<SkillType>(new [] { EntryLevel, Intermediate, Advanced });
public SkillType Skill { get; set; } = SkillTypes.EntryLevel;