In LINQ, you can find the maximum element of the given sequence by using Max() function. This method provides the maximum element of the given set of values. It does not support query syntax in C#, but it supports in VB.NET. It is available in both Enumerable and Queryable classes in C#. It returns null if all the elements present in the collection are null. It returns any type of data type means you can also use Max with the collection of a custom type(does not contain numeric value), but for this, you have to implement the IComparable interface. It can work with nullable, non-nullable decimal, double, floats, int, etc. values.
The sequence is: 20 45 50 79 90 79 89 100 567 29 Maximum Value: 567
Maximum Salary of the Employee: 50000
- LINQ | How to find minimum value of the given sequence?
- LINQ | How to find the sum of the given Sequence?
- LINQ | How to find average of the given sequence?
- LINQ | How to find aggregate of the given sequence?
- Count the number of element present in the sequence in LINQ?
- LINQ | Filtering Operator | OfType
- LINQ | Method Syntax
- LINQ | Join (Inner Join)
- LINQ (Language Integrated Query)
- LINQ | Set Operator | Except
- LINQ | Query Syntax
- LINQ | Element Operator | Last
- What is Query in LINQ?
- LINQ | Projection Operator | Select
- LINQ | Projection Operator | SelectMany
- LINQ | Filtering Operator | where
- LINQ | Sorting Operator | OrderBy
- LINQ | Sorting Operator | OrderByDescending
- LINQ | Sorting Operator | Reverse
- LINQ | Sorting Operator | ThenBy
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.