check if list contains a data member of an object c# code example Example: list contains type c# if (within.OfType<Ball>().Any())