Unlicense – Jay R. Wren – lazy dawg evarlast http://jrwren.wrenfam.com/blog babblings of a computer loving fool Wed, 15 Feb 2017 02:57:57 +0000 en-US hourly 1 https://wordpress.org/?v=4.7.2 I’m Lazy And I Need My Helpers http://jrwren.wrenfam.com/blog/2010/01/07/im-lazy-and-i-need-my-helpers/ http://jrwren.wrenfam.com/blog/2010/01/07/im-lazy-and-i-need-my-helpers/#comments Fri, 08 Jan 2010 02:27:48 +0000 http://jrwren.wrenfam.com/blog/?p=915 Continue reading "I’m Lazy And I Need My Helpers"]]> public static class NumericExtensions
{
public static bool IsZero(this byte number)
{
return 0==number;
}
public static bool IsZero(this short number)
{
return 0==number;
}
public static bool IsZero(this int number)
{
return 0==number;
}
public static bool IsZero(this long number)
{
return 0==number;
}
public static bool IsZero(this float number)
{
return 0==number;
}
public static bool IsZero(this double number)
{
return 0==number;
}
public static bool IsZero(this decimal number)
{
return 0==number;
}
}

I wanted something like this today as I was toggling between NUnit and MSTest. Sure, Assert.That( something, Is(0) ) is readable, but its not portable. Its NUnit only, and for this project, I can’t do that. I also like the english reading of IsZero() vs. Is(0)

I think I’ve stated before that any code on this blog (c) by me and licensed under the MIT/X11 License, but for certain bits of code, I see no point in that. So I’m going to start tagging code with CC0, Unlicense and/or WTFPL.

]]>
http://jrwren.wrenfam.com/blog/2010/01/07/im-lazy-and-i-need-my-helpers/feed/ 3