Monday, January 21, 2013

Usage of LET in LINQ


Usage of LET in LINQ




    var query = from row in dt.AsEnumerable()
                                let ptrn = PaternMatch(row, out rw2Str)
                                where ptrn != null
                                select new { row, ptrn, rw2Str };

     foreach (var qry in query)
            {              
                string.Format("Ptrn:[{0}] row2Str:[{1}]", qry.ptrn, qry.rw2Str));

                qry.row.Delete();
            }
            dt.AcceptChanges();






    private string PaternMatch(DataRow dr , out string rw2Str){

            rw2Str = "test row to string";
            return "test patern";
        }

 
       

No comments:

Post a Comment

Code Formater

Paste Here Your Source Code
Source Code Formatting Options
1) Convert Tab into Space :
2) Need Line Code Numbering :
3) Remove blank lines :
4) Embeded styles / Stylesheet :
5) Code Block Width :
6) Code Block Height :
7) Alternative Background :
Copy Formatted Source Code
 
Preview Of Formatted Code