Possible Duplicate:
Why is the 'this' keyword required to call an extension method from within the extended class
I want to localization my MVC application then I want to use w(message)
method and as
"flem" answered here I have this code:
namespace System.Web.WebPages
{
public static class Localization
{
public static string w(this WebPageBase page, string message)
{
return message;
}
}
}
but in razor page(page.cshtml
) I can't use @w("hi")
but @this.w("hi")
works. I want to know how it is possible to this.method()
works but method()
doesn't work?