// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; namespace Microsoft.AspNetCore.Mvc.Rendering { /// /// Name-related extensions for . /// public static class HtmlHelperNameExtensions { /// /// Returns the full HTML element name for the current model. Uses /// (if non-empty) to reflect relationship between /// current and the top-level view's model. /// /// The instance this method extends. /// A containing the element name. public static string NameForModel(this IHtmlHelper htmlHelper) { if (htmlHelper == null) { throw new ArgumentNullException(nameof(htmlHelper)); } return htmlHelper.Name(expression: null); } /// /// Returns the HTML element Id for the current model. /// /// The instance this method extends. /// A containing the element Id. public static string IdForModel(this IHtmlHelper htmlHelper) { if (htmlHelper == null) { throw new ArgumentNullException(nameof(htmlHelper)); } return htmlHelper.Id(expression: null); } } }