निम्न हमारी सरणी है:
int[] points = { 210, 250, 300, 350, 420 };
तत्वों को छोड़ने के लिए Skip() विधि का उपयोग करें। तर्क के रूप में संख्या जोड़ें जो लौटाए जाने वाले तत्वों की संख्या दर्शाती है:
IEnumerable<int> skipEle = points.AsQueryable().OrderByDescending(s => s).Skip(3);
पूर्ण कोड
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("प्रारंभिक सरणी...");
foreach (int res in points)
Console.WriteLine(res);
IEnumerable<int> skipEle = points.AsQueryable().OrderByDescending(s => s).Skip(3);
Console.WriteLine("3 तत्व छोड़े गए...");
foreach (int res in skipEle)
Console.WriteLine(res);
}
}
आउटपुट
प्रारंभिक सरणी... 210 250 300 350 420 3 तत्व छोड़े गए... 250 210