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.

3 thoughts on “I’m Lazy And I Need My Helpers”

  1. Oh, and btw- according a GPL guide I read somewhere (c) and the © symbol have no legal meaning. You have to actually say “copyright”. Also FWIW.

  2. Effectively that is what those “licenses” do is public domain something. It turns out that there is no legal way to declare something in the public domain. You can’t just say “I release this into the public domain”. Further, in some nations there is something called “moral rights”, which also have no ability to be transferred.

    see the problem statement at http://creativecommons.org/about/cc0 for details.

Comments are closed.