Javatpoint Logo
Javatpoint Logo

LINQ Max() Function

Max () function in LINQ is used to return the maximum value from the collection. With the help of Max() function, it is easy to find the maximum value from a given data source using Max () function. In the other case, we have to write the code to get the maximum value from the list of values.

Here is the syntax of using the LINQ Max () function to get the maximum value from the list or collection in C#.

LINQ Max () function syntax in C#

After observing the above syntax, we are getting the maximum value from the "a" list using LINQ Max () function.

Example: In this example, we are using the Max () function to get the maximum value from the list of array values in C#.

Output

From the above example, it will show the integer array "a," and we are finding the maximum value from the given array using LINQ Max () function.

Now we run the application, and it will display the maximum value from the list, as shown below in the output in the console window.

LINQ Max() Function





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA