list contains type c#

C#
if (within.OfType<Ball>().Any())
Source

Also in C#: