Checking For Empty Enumerations
While spelunking in some code recently I saw a method that looked something like this: public void Foo<T>(IEnumerable<T> items) {
if(items == null || items.Count() == 0) {
// Warn about emptiness
}
}
This method accepts a generic enumeration and then proceeds to check if the enumeration is null or empty. Do you see…