Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Linq Skip() Method
Skip elements and return the remaining elements using the Skip() method.
The following is an array.
int[] marks = { 80, 55, 79, 99 };
Now, let us skip 2 elements using Lambda Expressions, but this is done after arranging the elements in descending order.
IEnumerable<int> selMarks = marks.AsQueryable().OrderByDescending(s => s).Skip(2);
Example
using System;
using System.Linq;
using System.Collections.Generic;
public class Demo {
public static void Main() {
int[] marks = { 80, 55, 79, 99 };
IEnumerable<int> selMarks = marks.AsQueryable().OrderByDescending(s => s).Skip(2);
Console.WriteLine("Skipped the result of 1st two students...");
foreach (int res in selMarks) {
console.WriteLine(res);
}
}
}Advertisements