HOW TO CONVERT LAMBDA EXPRESSION TO FUNC<> VARIABLE

Ankita Pandey

Total Post:183

Points:1285
Posted by  Ankita Pandey
C# 
C#
 1793  View(s)
Ratings:
Rate this:

I have code for searching file. And now have Lambda Expression for filtering that.How to convert the Expression to Func<string> variable. 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;

  1. Pravesh Singh

    Post:412

    Points:2888
    Re: how to Convert Lambda expression to Func<> variable

    Hi Ankita,


    Try this :

    Func<string,bool> lambda = f => formatFile.Contains(f.Split('.').Last().ToLower());

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!