---
title: "how to Convert Lambda expression to Func&lt;&gt; variable"  
description: "how to Convert Lambda expression to Func&lt;&gt; variable"  
author: "Anonymous User"  
published: 2014-08-18  
updated: 2014-08-18  
canonical: https://www.mindstick.com/forum/2053/how-to-convert-lambda-expression-to-func-lt-gt-variable  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# how to Convert Lambda expression to Func&lt;&gt; variable

I have [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) for searching file. And [now](https://yourviews.mindstick.com/view/81402/it-s-liberals-vs-progressives-in-us-politics-now) have [Lambda Expression](https://www.mindstick.com/forum/159550/how-to-implement-an-interface-with-two-abstract-methods-by-a-lambda-expression) for [filtering](https://www.mindstick.com/forum/33958/how-to-filtering-with-the-entity-framework-is-an-asp-dot-net-mvc-application) that.How to [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) the Expression to [Func](https://www.mindstick.com/forum/157161/can-elaborate-difference-between-func-vs-action-vs-predicate)<[string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp)> [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation). Thanks

## Code :

```
Directory.GetFiles(folder, "*" + KeyWord +
"*").Where(f =>formatFile.Contains(f.Split('.').Last().ToLower()));into variable :Func<string> Lambda = ?? (f =>formatFile.Contains(f.Split('.').Last().ToLower())) \\ convert the Expression;
```

## Replies

### Reply by Pravesh Singh

Hi Ankita,\
Try this :

Func<string,bool> [lambda](https://www.mindstick.com/blog/181/lambda-expression-in-c-sharp) = f => formatFile.Contains(f.Split('.').Last().ToLower());


---

Original Source: https://www.mindstick.com/forum/2053/how-to-convert-lambda-expression-to-func-lt-gt-variable

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
