uses Max to get the highest number in an integer array. : Max « LINQ « C# / C Sharp






uses Max to get the highest number in an integer array.

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {
        int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };

        int maxNum = numbers.Max();

        Console.WriteLine("The maximum number is {0}.", maxNum);
    }
}

 








Related examples in the same category

1.Max on int array
2.Max on String array
3.Max on object list
4.Max on Object list array
5.uses Max to get the length of the longest word in a string array.
6.Grouped Max
7.Get the Min and max value from a query