C# check if list contains code example
Example 1: check if list of objects contains value c#
bool contains = pricePublicList.Any(p => p.Size == 200);
Example 2: list contains type c#
if (within.OfType<Ball>().Any())
bool contains = pricePublicList.Any(p => p.Size == 200);
if (within.OfType<Ball>().Any())