Sau đây là mảng của chúng tôi -
int[] points = { 210, 250, 300, 350, 420}; Sử dụng phương thức bỏ qua () để bỏ qua các phần tử. Thêm số làm đối số hiển thị số phần tử được trả về.
IEnumerable<int> skipEle = points.AsQueryable().OrderByDescending(s => s).Skip(3);
Ví dụ
using System;
using System.Linq;
using System.Collections.Generic;
public class Demo {
public static void Main() {
int[] points = { 210, 250, 300, 350, 420};
Console.WriteLine("Initial array...");
foreach (int res in points)
Console.WriteLine(res);
IEnumerable<int> skipEle = points.AsQueryable().OrderByDescending(s => s).Skip(3);
Console.WriteLine("Skipped 3 elements...");
foreach (int res in skipEle)
Console.WriteLine(res);
}
} Đầu ra
Initial array... 210 250 300 350 420 Skipped 3 elements... 250 210