c# if list contains same strings code example Example: list contains type c# if (within.OfType<Ball>().Any())