---
title: "Use Aggregation Operator  Max in Linq."  
description: "Use Aggregation Operator  Max in Linq."  
author: "Norman Reedus"  
published: 2016-03-21  
updated: 2016-03-21  
canonical: https://www.mindstick.com/forum/34071/use-aggregation-operator-max-in-linq  
category: "linq"  
tags: ["linq"]  
reading_time: 1 minute  

---

# Use Aggregation Operator  Max in Linq.

We want to use [Aggregation](https://www.mindstick.com/forum/217/what-is-aggregation-and-how-it-maps-into-a-java-class) [Operator](https://www.mindstick.com/blog/144/union-intersection-and-except-operator-in-sql-server) [Max](https://www.mindstick.com/articles/1155/count-max-min-function-in-excel) in Linq. How to use this please help me.

## Replies

### Reply by Anonymous User

The Max operator returns the largest numeric element from a collection.

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Prototype
{
    class Example
    {
        static void Main()
        {
            IList<employee> List = new List<employee>() {
            new employee() { id = 1, empname = "manoj", age = 18 } ,
            new employee() { id = 2, empname = "stephan",  age = 15 } ,
            new employee() { id = 3, empname = "sivil",  age = 25 } ,
            new employee() { id = 4, empname = "mohan" , age = 20 } ,
            new employee() { id = 5, empname = "johan" , age = 19 },
            new employee() { id = 6, empname = "Ram" , age = 18 }
               };

            var maxAge = List.Max(s => s.age);

            Console.WriteLine("Maximum Age of Employee: {0}", maxAge);

            Console.ReadLine();
        }
    }
    class employee
    {
        public int id { get; set; }
        public string empname { get; set; }
        public int age { get; set; }
    }
}
```

![Use Aggregation Operator  Max in Linq.](https://www.mindstick.com/mindstickforums/aaa95f9d-9414-4b3f-a1ce-bcf9b0cee714/images/f1895ea6-040d-4879-b7d5-672cfed96716.png)


---

Original Source: https://www.mindstick.com/forum/34071/use-aggregation-operator-max-in-linq

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
