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 the sum of the given Sequence?
- LINQ | How to find aggregate of the given sequence?
- LINQ | How to find minimum value of the given sequence?
- LINQ | How to find average of the given sequence?
- Count the number of element present in the sequence in LINQ?
- What is Query in LINQ?
- LINQ | Set Operator | Except
- LINQ | Let Keyword
- LINQ | Partition Operator | Take
- LINQ | Method Syntax
- Aggregation Function in LINQ
- LINQ | Quantifier Operator | Contains
- Cross Join in LINQ
- LINQ | Set Operator | Union
- LINQ | Quantifier Operator | All
- LINQ | Quantifier Operator | Any
- LINQ | Query Syntax
- LINQ | Set Operator | Intersect
- LINQ | Element Operator | First
- LINQ | Element Operator | Last
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.