Even simpler:
if ( (new HashSet<double> ( myList )).Count == 1 ) ...
Your code pretty much devolves to this anyway.
On the other hand, the first example you provide is probably more efficient, mainly due to the short-circuit. And if you put it in a library function, you just call it and then there's no concern about elegance.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.