How to

get minimum number from collection

Published: 9. October 2011 | Updated: 9. October 2011
License: Microsoft Public License (MS-PL)
Categories: Collections » Linq, Framework » Math
Tags: C# Linq Math
Was this snippet helpful for you? YESYES / NONO

Import namespace

using System.Linq;

Code

int[] numbers = new[] { 5, 10, 30, 100 };

int min = numbers.Min();

Console.WriteLine(min);
Console Output:
5
Send us feedback about this snippet »



Related Snippets: