开发者

linq changing order of columns

I have an IQueryable that's returned from a query.

The colu开发者_StackOverflow中文版mns are Article, Id, Lot.

What's a simple linq way to have the columns Id, Article, Lot.


You are working with objects that have named properties corresponding to the columns in the database. The order shouldn't matter.


The simplest way I found is

from t in table 
select new{ Id = t.Id, Article = t.Article, Lot = t.Lot }

as @driis says order doesnt matter.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜