DateTime check;
bool weddingExistsAtCheckDate = weddings.Any(wedding => wedding.When == check);
Clarification:
The Any method takes a Func<T, bool>
for T being the class that is in the container.
Assuming you had a function
bool SomeFunc(Wedding wedding) { return wedding.When == check }
you could have passed that:
bool weddingExistsAtCheckDate = weddings.Any(SomeFunc);
However, then you'd have to get check
in there somehow. Anyway, the function above can be shortened to :
bool weddingExistsAtCheckDate = weddings.Any((Wedding wedding) => { return wedding.When == check });
Which can again be shortened to:
bool weddingExistsAtCheckDate = weddings.Any(wedding => wedding.When == check);
because all the other syntax was something that the compiler already knew anyway... anything else and it would have complained.
The resulting short version is called a lambda expression
.