LINQ | How to find maximum value of the given sequence?
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
My Personal Notes arrow_drop_up
Please Login to comment...