简体   繁体   中英

I want to get table record using linq query but start from other row not from first row

I have table in SQL

id   datetime     
---|------------|
1  | January    |
2  | February   | 
3  | March      | 
4  | April      |
5  | May        |  
6  | June       | 
7  | July       | 
8  | August     | 
9  | September  | 
10 | October    | 
11 | November   | 
12 | December   | 

When select record result start from january but I want to get complete record but start from july...

You want to start from July so first make list which start from july. And then union it with rest of items.

Try with this

var result = modelList.Where(x => x.id > 6).ToList().
                Union(modelList.Where(y => y.id < 7).Distinct().ToList()).ToList();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM