how to Convert Lambda expression to Func<> variable

Total Post:183

Points:1285
C# 
C#
 2309  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. 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