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.
精彩评论