LinQ中List,取某个字段,然后用逗号拼接 string htDetails = string.Join(",", DemoList.Select(t => t.id).Distinct().ToArray());