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
};
var min1 = numbers.Min(number => number);
Console.WriteLine("Min 1: " + min1);
var min2 = numbers.Where(number => number > 0).Min(number => number);
Console.WriteLine("Min 2: " + min2);
Console.ReadLine();
}
}
}
Output
Min 1: -9
Min 2: 2