I have a nullable type, e.g. SomeEnum?
and a set of values, e.g. IEnumerable<SomeEnum?>
.
How to check that all items has the same value using LINQ (and get this value)?
data.Distinct().Count() == 1;
works well too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With