我正在尝试这样的查询......
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