开发者

change linq query result value's after performing queries, filters and so on

开发者 https://www.devze.com 2023-01-01 18:52 出处:网络
i want to change record\'s in result of linq query. how? my query : var results = (from myTable in db.MyTable

i want to change record's in result of linq query. how?

my query :

var results = (from myTable in db.MyTable                               
               where //some condition here
               orderby myTable.Count descending
               select new QueryResult()
               {
                   Title = files.Title,
               }).AsQueryable();

after performing query, i want to change Title property of QueryResult on e开发者_如何学Cach record, but i don't know how?

results = results.???


just use a foreach on results


To update the LINQ result using FOREACH loop, I first create local ‘list’ variable and then perform the update using FOREACH Loop. The value are updated this way.

0

精彩评论

暂无评论...
验证码 换一张
取 消