using System;
using System.Collections.Generic;
using System.Linq;
namespace NilPointer
{
class Program
{
static void Main(string[] args)
{
var numbers = new List<int> {
50, 2, -7, 11,-9, 26, 6, 42
};
Console.WriteLine("Limit 1");
numbers.Take(3).ToList().ForEach(number =>
{
Console.Write(number + " ");
});
Console.WriteLine("\nLimit 2");
numbers.Skip(2).Take(3).ToList().ForEach(number =>
{
Console.Write(number + " ");
});
Console.WriteLine("\nLimit 3");
numbers.OrderByDescending(number => number).Take(3).ToList().ForEach(number =>
{
Console.Write(number + " ");
});
Console.ReadLine();
}
}
}
Limit 1
50 2 -7
Limit 2
-7 11 -9
Limit 3
50 42 26