1

文字列に下線が引かれた「Expected class, interface, enum or struct」というエラーが表示されるのはなぜですか?

 public static string IsSelected(this HtmlHelper helper, string A, string B)

    {
         return "wtf";

    }
4

1 に答える 1

6

拡張メソッドは静的クラス内にある必要があります。

public static class MyExtensions
{
    public static string IsSelected( this HtmlHelper helper, string A, string B)
    {
        return "wtf";

    }
}
于 2009-01-21T21:24:52.003 に答える