我有一个这样的字符串列表:

{"100", "101, "101", "102, "103, "103", "104", "104", "105"}

而且我需要获得仅具有不同值的字符串的新列表:

{"100","101","102","103","104","105"}

有人有快速的方法吗?

最佳答案

List<String> strings = new List<string>() { "100", "101", "101", "102", "103", "103", "104", "104", "105" };
var distinctStrings = strings.Distinct().ToList();

关于c# - 从字符串列表中获取唯一值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6114086/

10-11 11:41