开发者

How to make HTML Helpers that supports generic type?


public static class 开发者_Python百科EmptyOrNullHelper

public static string EmptyOrNull(this HtmlHelper helper, IQueryable(T) type)
{
//Code
}

}


Like so:

public static class EmptyOrNullHelper
{

    public static string EmptyOrNull<T>(this HtmlHelper helper, IQueryable<T> type)
    {
        //Code
    }

}

In other words, specify the generic parameter for the method that you want to use in one of its parameters. You'll not need to do this where the method is called normally, just in the declaration.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜