LINQ: Add RowNumber Column

前端 未结 9 1080
广开言路
广开言路 2020-11-29 07:26

How can the query below be modified to include a column for row number (ie: one-based index of results)?

var myResult = from currRow in someTable
                    


        
9条回答
  •  天命终不由人
    2020-11-29 07:48

    According to you edit 1. NO, YOU CAN'T Linq returns the table as it is. You can build each column, but you lose the power of mapped entities.

    This has been asked multiple times before: How do you add an index field to Linq results

提交回复
热议问题