我已经简化了一段延迟执行的代码,但是怎么才能在不使用try/catch的情况下检查以下内容不为空/空字符串呢?
string[] nullCollection = null;
IEnumerable<string> ienumerable = new[] { nullCollection }.SelectMany(a => a);
bool isnull = ienumerable == null; //returns false
bool isany = ienumerable.Any(); //throws an exception