Get Max value in String array using LINQ in CSharp

Description

The following code shows how to get Max value in String array using LINQ.

Example


  /* w w w. ja  va 2s.  c o  m*/
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class MainClass {
    public static void Main() {
        string[] presidents = {"G", "H", "H", "H", "H", "J"};
        string maxName = presidents.Max();
        Console.WriteLine(maxName);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ