Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 C# 并且有一个IEnumerable对象。注意(IEnumerable而不是IEnumerable<T>)
IEnumerable
IEnumerable<T>
如何在该对象中找到不同的项目?
使用Cast,然后Distinct
Cast
Distinct
var distinctItems = items.Cast<object>().Distinct();