LINQ Max() with Nulls

后端 未结 8 1694
自闭症患者
自闭症患者 2020-12-29 00:49

I have a list that contains a bunch of Points (with an X and Y component).

I want to get the Max X for all points in the list, like this:

double max          


        
8条回答
  •  梦毁少年i
    2020-12-29 01:38

    Nullable column with max is as follow

    var maximum = objectEntity.where(entity => entity.property != null).max(entity => entity.property.HasValue);
    

    Above statement return maximum number of entity property

提交回复
热议问题