奇数オカレンスの配列の番号が必要です。linqクエリの出力 - > System.Linq.Lookup`2 +グループ化[System.Int32、System.Int32]
これは私のコードです。私はそれが動作していると思うが、私は文字列として期待数2を出力することはできません。私は
System.Linq.Lookup`2+Grouping[System.Int32,System.Int32]
を代わりに持っています。問題を解決するための
int[] array = { 0, 0, 1, 1, 2 };
var result = array.GroupBy(a => a)
.Select(o => o)
.Where(o => (o.Count() % 2 == 1))
.FirstOrDefault();
Console.WriteLine(result.ToString());
を2 == 1).Key –