How to make HTML helpers supporting a generic type?


public static class EmptyOrNullHelper

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

}

+3
source share
1 answer

Same:

public static class EmptyOrNullHelper
{

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

}

In other words, specify a general parameter for the method that you want to use in one of its parameters. You will not need to do this when the method is called normally, only in the declaration.

+3
source

Source: https://habr.com/ru/post/1747962/


All Articles