我有一个客户列表customer
,想要将其id
单独列为一个列表List<int>
。
我尝试使用以下方法:
customerList.Cast<int>.Distinct().ToList()
但它没有起作用。我还想在列表中区分不同的客户。
我该如何使用 LINQ
语法实现这个功能?我应该在我的查询中进行哪些更改?
我有一个客户列表customer
,想要将其id
单独列为一个列表List<int>
。
我尝试使用以下方法:
customerList.Cast<int>.Distinct().ToList()
但它没有起作用。我还想在列表中区分不同的客户。
我该如何使用 LINQ
语法实现这个功能?我应该在我的查询中进行哪些更改?