Implicit convert List

后端 未结 4 662
夕颜
夕颜 2020-12-03 17:11

I am using Linq to Entities.

Have an entity \"Order\" which has a nullable column \"SplOrderID\".

I query my Orders list as

List          


        
4条回答
  •  清歌不尽
    2020-12-03 17:44

    I found your question trying resolve the same problem, and after a few tries, i got this solution, cast int for each property on the list created by select

    List lst = Orders.where(u=> u.SplOrderID != null).Select(u => (int)u.SplOrderID);
    

提交回复
热议问题