This sample demonstrates a simple LINQ to Objects operation: retrieving all the first five items from a `List
This is a demonstration of a fundamental concept - retrieving data based on a series of steps.
The code is designed for clarity and readability.
using System;
using System.Collections.Generic;
using System.Linq;
public class LinqToObjectsExample {
public static void Main(string[] args) {
List data = new List { "Alice", "Bob", "Charlie", "David", "Eve" };
var result = data.Take(5).ToList();
foreach (string item in result) {
Console.WriteLine(item);
}
}
}