I think that my code should make the ViewBag.test property equal to \"No Match\", but instead it throws an InvalidOperationException.
ViewBag.test
\"No Match\"
InvalidOperationException
Give this a shot:
bool hasMatch = str.Split(',').Any(x => x.Equals(another)); ViewBag.test = hasMatch ? "Match" : "No Match";