Thursday, October 22, 2009

Extensions

Just found out about a nice feature unknowed by me atleast...Extensions!

Just create something like:

public static class Extensions
{
bool MYMETHOD(this int value)
{
return whatever;
}

This will cause an extension to the int32 class, so in every int you will be able to call MYMETHOD, like this:

int n = 4;
if(n.MYMETHOD())
do something;

Maybe alot of you already know this but i didnt...pretty usefull.