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.
LINQ を使用して、一度だけ発生するすべての int 要素のリストを取得できますか?
例えば
{1,2,4,8,6,3,4,8,8,2}
になるだろう
{1,6,3}
ありがとう!
var result = from x in xs group xs by x into grp where grp.Count() == 1 select grp.Key;
そのように?
50秒遅すぎる...:/
list.GroupBy(i => i) .Where(g => g.Count() == 1) .Select(g => g.First());