C# Practice Exercises

Paginate with Skip and Take

Select one page from an ordered sequence.

Introduction

Skip and Take compose a predictable page window after ordering.

For one-based page numbers, skip (page - 1) multiplied by the page size.

Runnable C# example

C#
Run code →
Program.cs
using System;
using System.Linq;
class Program
{
    static void Main()
    {
        int page = 2, size = 3;
        var items = Enumerable.Range(1, 10).Skip((page - 1) * size).Take(size);
        Console.WriteLine(string.Join(", ", items));
    }
}
Result of running the code
4, 5, 6

Practice with the debugger

Set a breakpoint on an important assignment or condition, click Debug, and inspect the local values before stepping to the next line.

Practice with a challenge

Use what this lesson covers to solve a real problem. Each challenge runs in your browser with instant tests and an AI review.

All challenges