C# use Hashset to filter duplicate List elements

Take the filter string as an example:

            List<string> lsTest = new List<string>() { "aaa", "bbb", "ccc", "aaa" };
            HashSet<string> hs = new HashSet<string>(lsTest);
The filtered hs contains only the first three elements.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325547996&siteId=291194637