String.IsNullOrWhiteSpace in LINQ Expression

前端 未结 5 1577
醉梦人生
醉梦人生 2020-11-28 21:00

I have the following code:

return this.ObjectContext.BranchCostDetails.Where(
    b => b.TarrifId == tariffId && b.Diameter == diameter
        ||         


        
5条回答
  •  伪装坚强ぢ
    2020-11-28 21:26

    You can also use this to check for whitespace:

    b.Diameter!=null && !String.IsNullOrEmpty(b.Diameter.Trim())
    

提交回复
热议问题