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
public int GetResult(List list){ int first = list.First(); return list.All(x => x == first) ? first : SOME_OTHER_VALUE; }