我有空格列表(" _ _")
List<string> MyList = (List<string>)Session["MyList "];
if(MyList !=null || MyList != "")
{
}
Run Code Online (Sandbox Code Playgroud)
如果字符串有更多空间,则MyList!=""不起作用
如何通过在c#中使用linq检查我的列表字符串是""还是null?
Dam*_*ith 17
if(MyList!=null || MyList.All(x=>string.IsNullOrWhiteSpace(x)))
{
}
Run Code Online (Sandbox Code Playgroud)