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