I have some static helper class:
public static class Helper
{
public static bool IsNull<T>(this T value) where T : class
{
return (value == null);
}
public static bool NotNull<T>(this T value) where T : class
{
return (!value.IsNull<T>());
}
public static bool IsNullOrEmpty(this string value)
{
return string.IsNullOrEmpty(value);
}
public static bool NotNullAndNotEmpty(this string value)
{
return (!value.IsNullOrEmpty());
}
public static bool NotNullAndNotEmpty(this ICollection value)
{
return (value.NotNull<ICollection>() && (value.Count > 0));
}
public static bool IsNullOrEmpty(this ICollection value)
{
return (!value.NotNullAndNotEmpty());
}
}
It is comfortable (habit) for me to use this helper, but I am not sure, that it is correctly (worth it), how about performance? probably there are any other reasons don't use it?
Thanks.
IsNullOrEmptyjust replacing the same exact extension? – Fuji Dec 7 '11 at 14:27