Any ideas? I marked it as static but it's not working!
class ExtensionMethods
{
public static int Add(this int number, int increment)
{
return number + increment;
}
}
Any ideas? I marked it as static but it's not working!
class ExtensionMethods
{
public static int Add(this int number, int increment)
{
return number + increment;
}
}
You are missing a static on the class. The compiler should have told you this?
public static class ExtensionMethods
I think, it needs to be defined in a static class:
namespace MyNameSpace
{
public static class ExtensionMethods
{
public static int Add(this int number, int increment)
{
return number + increment;
}
}
}
You must also include a using MyNameSpace;
in the code file you want to use them in, unless it is in the same namespace