Extension method by type
Is there a way to create an extension method for a type? It seems I can only create them for instances.
public static class MyExtensions
{
public static string Test(this string s)
{
return "test";
}
}
public class Test
{
static void TestIt()
{
string.Test(); // won't compile
string s = null;
s.Test();
}
}
+2
source to share