I have a big list of strings (about 5k-20k entries) that I need to order and also to remove duplicates from.

I've done this in 2 ways now, once with a hashset and once solely with linq. Tests with that number of entries did not show a big difference but I'm wondering what way and thus what method would be better suited.

For the ways (myList is of the datatype List):

**Linq:** I'm using 1 linq statement to order the list and get the distinct values from it.

```
myList = myList.OrderBy(q => q).Distinct().ToList();

```

**Hashset:** I'm using hashset to remove all duplicates and then I'm ordering the list

```
myList = new HashSet<String>(myList).ToList<String>();
myList = myList.OrderBy(q => q).ToList();

```

Like I said tests I made were about the same time consumption for both methods but I'm still wondering if one method is better than the other and if so why (the code is for a high performance part and I need to get every millisecond I can out of it).