I am really excited about extension methods and once C# 3.0 is released I’m going to extend every collection class with IsEmpty, IsNotEmpty functions. They should look like that:
1: public static bool IsEmpty(this ArrayList list)
2: {
3: return list.Count == 0;
4: }
5:
6:
7: public static bool IsNotEmpty(this ArrayList list)
8: {
9: return list.Count > 0;
10: }
I know that it’s not big deal but I would rather write:
if (list.IsEmpty()) then if (list.Count == 0). The first one is
just much more readable.