What actions are you taking if the value returned is 0?
If that's what's interesting, maybe you should use Haack's IsNullOrEmpty
extension method for IEnumerable
like so:
public static bool IsNullOrEmpty<T>(this IEnumerable<T> items)
{
return items == null || !items.Any();
}
The link is http://haacked.com/archive/2010/06/10/checking-for-empty-enumerations.aspx
Posted as a comment on the blog, you'll also find an Exception
class I wrote to go with that:
public class ArgumentNullOrEmptyException : ArgumentNullException
{
public ArgumentNullOrEmptyException( string paramName ) : base( paramName )
{}
public ArgumentNullOrEmptyException( string paramName, string message ) : base( paramName, message )
{}
public override string Message
{
get
{
return "Value cannot be null nor empty.{0}Parameter name: {1}".FormatWith( Environment.NewLine, ParamName );
}
}
}