相关疑难解决方法(0)

LINQ语法,其中字符串值不为null或为空

我正在尝试这样的查询......

query.Where(x => !string.IsNullOrEmpty(x.PropertyName));
Run Code Online (Sandbox Code Playgroud)

但它失败了......

所以现在我已经实现了以下功能......

query.Where(x => (x.PropertyName ?? string.Empty) != string.Empty);
Run Code Online (Sandbox Code Playgroud)

有没有更好的(更本地?)方式LINQ处理这个?

编辑

道歉!没有包含提供程序......这是使用LINQ to SQL

linq linq-to-sql

36
推荐指数
2
解决办法
11万
查看次数

标签 统计

linq ×1

linq-to-sql ×1