Using Max to get the highest number in an integer array. : Max « LINQ « C# / CSharp Tutorial






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);
    }
}








22.54.Max
22.54.1.Max on int array
22.54.2.Max on String array
22.54.3.Max on object list
22.54.4.Max on Object list array
22.54.5.Using Max to get the highest number in an integer array.
22.54.6.uses Max to get the length of the longest word in a string array.
22.54.7.Grouped Max
22.54.8.Get the Min and max value from a query
22.54.9.Numeric Aggregates: max