Alloy.Helpers.HtmlHelpers.BeginConditionalLink C# (CSharp) Метод

BeginConditionalLink() публичный статический Метод

Writes an opening ]]> tag to the response if the shouldWriteLink argument is true. Returns a ConditionalLink object which when disposed will write a closing ]]> tag to the response if the shouldWriteLink argument is true.
Overload which only executes the delegate for retrieving the URL if the link should be written. This may be used to prevent null reference exceptions by adding null checkes to the shouldWriteLink condition.
public static BeginConditionalLink ( this helper, bool shouldWriteLink, Func urlGetter, string title = null, string cssClass = null ) : ConditionalLink
helper this
shouldWriteLink bool
urlGetter Func
title string
cssClass string
Результат ConditionalLink
        public static ConditionalLink BeginConditionalLink(this HtmlHelper helper, bool shouldWriteLink, Func<IHtmlString> urlGetter, string title = null, string cssClass = null)
        {
            IHtmlString url = MvcHtmlString.Empty;

            if(shouldWriteLink)
            {
                url = urlGetter();
            }

            return helper.BeginConditionalLink(shouldWriteLink, url, title, cssClass);
        }

Same methods

HtmlHelpers::BeginConditionalLink ( this helper, bool shouldWriteLink, IHtmlString url, string title = null, string cssClass = null ) : ConditionalLink