jjzjj

reportGraphs

全部标签

c# - 如何测试一个空的 generic.dictionary 集合?

如何测试通用字典对象以查看它是否为空?我想按如下方式运行一些代码:while(reportGraphs.MoveNext()){reportGraph=(ReportGraph)reportGraphs.Current.Value;report.ContainsGraphs=true;break;}reportGraph对象的类型是System.Collections.Generic.Dictionary运行此代码时,reportGraphs字典为空,MoveNext()立即抛出NullReferenceException。如果有更高效的方法来处理空集合,我不想在block周围放置tr