❔ Compare Enum Values with submitted value

Hi, how can I compare the submitted value with values in an enum without using switch-case? For example,
public enum Weekends {
  Saturday,
  Sunday
}

[HttpPost]
public async Task<IActionResult> Create([FromForm] Day day)
{
  var weekendvalues = Enum.GetNames(typeof(Weekends));  
  var values = string.Join(", ", weekendvalues); 

  if (day.Day != values) {
    // Do something
  }
  else if () {
    // Some other things
  }
}
Was this page helpful?