public static bool AddClass(this TagHelperAttributeList attributes, string className) { if (string.IsNullOrWhiteSpace(className)) { throw new ArgumentNullException(nameof(className)); } if (!attributes.TryGetAttribute("class", out TagHelperAttribute classAttribute)) { attributes.Add(new TagHelperAttribute("class", className)); return(true); } if (attributes.ContainsClass(className)) { return(false); } string classes = classAttribute.Value.ToString(); attributes.SetAttribute("class", string.Join(" ", className, classes)); return(true); }