check if a string is in a list c# code example Example: list contains type c# if (within.OfType<Ball>().Any())