---
title: "What are LINQ Lambda Expressions for example?"  
description: "What are LINQ Lambda Expressions for example?"  
author: "Ethan Karla"  
published: 2021-09-24  
updated: 2021-09-24  
canonical: https://www.mindstick.com/forum/156756/what-are-linq-lambda-expressions-for-example  
category: "linq"  
tags: ["c#", "ado.net", "linq"]  
reading_time: 2 minutes  

---

# What are LINQ Lambda Expressions for example?

What are [LINQ](https://www.mindstick.com/articles/12007/language-integrated-query-linq-queries) [Lambda Expressions](https://www.mindstick.com/forum/159557/c-plus-plus-lambda-expressions-how-does-the-compiler-interpret-them) for example?

## Replies

### Reply by Ravi Vishwakarma

That is, **[Lambda](https://www.mindstick.com/blog/181/lambda-expression-in-c-sharp) Expression** only provides the facility to specify the syntax of the Anonymous Method in a simple way. In place of the Anonymous Method, we can also use Lambda [Expressions](https://www.mindstick.com/forum/33876/what-is-the-syntax-for-lambda-expressions-in-vb-dot-net), which is more convenient to use than Anonymous Methods.

## LINQ Lambda Expressions Syntax

```
(Input Parameter) => Method Expression
```

Lambda Expression is dynamic variable and decides the type in compile time.

intAry.Where( x => x%2 == 0 );

in this example x is dynamic variable, and this expression { x%2 == 0 } check the x is even or odd.

## Example

```
using System;using System.Linq;using System.Collections.Generic;class MyProgram{     static void Main(string[ ] args)    {       int[] intAry = {45,78,5,896,4,5,8,65,99,66,55,88,5,558,56,55,45,23};      Console.WriteLine('Even list ');      var Evenlist = intAry.Where( x => x%2 == 0 );       Evenlist.ToList().ForEach(x => Console.Write(x+ ', '));
      Console.WriteLine('\nOdd list ');      var Oddlist = intAry.Where( x => x%2 != 0 );      Oddlist.ToList().ForEach(x => Console.Write(x + ', '));    } }
```

## Output

```
Even list 78, 896, 4, 8, 66, 88, 558, 56, Odd list 45, 5, 5, 65, 99, 55, 5, 55, 45, 23, 
```


---

Original Source: https://www.mindstick.com/forum/156756/what-are-linq-lambda-expressions-for-example

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
