If all the items in a list have the same value, then I need to use that value, otherwise I need to use an “otherValue”. I can’t think of a simple and clear way of doing this
return collection.All(i => i == collection.First())) ? collection.First() : otherValue;.
Or if you're worried about executing First() for each element (which could be a valid performance concern):
var first = collection.First(); return collection.All(i => i == first) ? first : otherValue;