「LINQ - 要素の取得」の版間の差分

ナビゲーションに移動 検索に移動
 
145行目: 145行目:
  Console.WriteLine(source.TakeWhile(e => e < 5).ToResult());
  Console.WriteLine(source.TakeWhile(e => e < 5).ToResult());
  // → {3, 4}
  // → {3, 4}
// 組み合わせ 1
Console.WriteLine(numbers.Where(x => x % 2 == 0).Take(2).ToResult());
// -> {4, 6}
// 組み合わせ 2
Console.WriteLine(source.Skip(2).Take(4).ToResult());
// -> {5, 6, 7, 8}
// 組み合わせ 3
Console.WriteLine(source.Where(x => x > 4).Distinct().ToResult());
// -> {5, 6, 7, 8, 9}
  </syntaxhighlight>
  </syntaxhighlight>
<br><br>
<br><br>

案内メニュー