In order to explain this blog. Let's create a list of string with the below values in it:
- List<string> lst = new List<string>();
- lst.Add("Abstract");
- lst.Add("Sealed");
- lst.Add("Interface");
- lst.Add("Abstract");
- lst.Add("Singleton");
The query is as below:
- var anyDuplicate = lst.GroupBy(x => x).Any(y => y.Count() > 1);
We can also use the same query (with some modifications) for checking if all the members of the list are unique. The query is as below:
- var unique = lst.GroupBy(x => x).Any(y => y.Count() == 1);
It returns True if the list is unique and returns False otherwise.
Hope it Helped
Thanks

Akash MalhotraPosted Sep 12, 2015, 5:10 PM
Nice
pooja guptaPosted Sep 8, 2015, 3:59 AM
good job