虽然static报错

Although static gives an error

我正在写一个关于日期时间的帮助程序。

public static class DatepickerHelper
{
    public static MvcHtmlString Datepicker(this HtmlHelper htmlHelper, string name, object value = null, object htmlAttributes = null, EInputAddonPosition? addonPosition = EInputAddonPosition.Right, EInputGroupSize? groupSize = EInputGroupSize.Medium, EDateTimePickerFormat? Format = EDateTimePickerFormat.GunAyYil, bool? showRemoveButton = false, string onChangeFn = "");

    public static MvcHtmlString DatepickerFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object htmlAttributes = null, EInputAddonPosition? addonPosition = EInputAddonPosition.Right, EInputGroupSize? groupSize = EInputGroupSize.Medium, EDateTimePickerFormat? Format = EDateTimePickerFormat.GunAyYil, bool? showRemoveButton = false, string onChangeFn = "");

    public static string GetStringValue(Enum value);
}

所有静态方法..看起来类似的错误,但我不明白

错误:

DatepickerHelper.DatepickerFor(HtmlHelper, Expression>, object, EInputAddonPosition?, EInputGroupSize?, EDateTimePickerFormat?, bool?, string)' must declare a body because it is not marked abstract, extern, or partial

静态方法需要方法体。

您当前的实现实际上什么都不做。

这将使您克服当前的错误,但请注意 throw new NotImplementedException(); - 您需要实际实施该方法,并且 return 一个适当的值。

public static class DatepickerHelper
{
    public static MvcHtmlString Datepicker(this HtmlHelper htmlHelper, string name, object value = null, object htmlAttributes = null, EInputAddonPosition? addonPosition = EInputAddonPosition.Right, EInputGroupSize? groupSize = EInputGroupSize.Medium, EDateTimePickerFormat? Format = EDateTimePickerFormat.GunAyYil, bool? showRemoveButton = false, string onChangeFn = "")
    {
        //notice there's a body to this static method now
        throw new NotImplementedException();
    }


    public static MvcHtmlString DatepickerFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object htmlAttributes = null, EInputAddonPosition? addonPosition = EInputAddonPosition.Right, EInputGroupSize? groupSize = EInputGroupSize.Medium, EDateTimePickerFormat? Format = EDateTimePickerFormat.GunAyYil, bool? showRemoveButton = false, string onChangeFn = "")
    {
        //notice there's a body to this static method now
        throw new NotImplementedException();
    }

    public static string GetStringValue(Enum value)
    {
        //notice there's a body to this static method now
        throw new NotImplementedException();
    }
}