thoughts on programming and computer related stuff RSS 2.0
# Saturday, August 23, 2008

In .NET there is a String.IsNullOrEmpty, but there is no similar thing on an Array. There should be, and there is a solution is in the new extension methods. This one works for all collections.

using System.Collections;

namespace MyExtensions
{
  public static class CollectionExtensions
  {
    public static bool IsNullOrEmpty(this ICollection col)
    {
      return (col == null || col.Count == 0);
    }
  }
}

Saturday, August 23, 2008 8:58:13 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
.NET
Navigation
Archive
<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Gaute Magnussen
Sign In
Statistics
Total Posts: 17
This Year: 0
This Month: 0
This Week: 0
Comments: 1
Themes
Pick a theme:
All Content © 2010, Gaute Magnussen
DasBlog theme 'Business' created by Christoph De Baene (delarou)