How do I test a generic dictionary object to see whether it is empty? I want to run some code as follows:
while (reportGraphs.MoveNext())
{
reportGraph = (ReportGraph)reportGraphs.Current.Value;
report.ContainsGraphs = true;
break;
}
The reportGraph object is of type System.Collections.Generic.Dictionary When running this code then the reportGraphs dictionary is empty and MoveNext() immediately throws a NullReferenceException. I don't want to put a try-catch around the block if there is a more performant way of handling the empty collection.
Thanks.