/// <summary> /// Returns the MarkupAttribute with the supplied name (case-insensitive), or null if not found. /// </summary> /// <param name="attributeName">The name of the desired attribute.</param> /// <returns>The MarkupAttribute that was found.</returns> public MarkupAttribute GetAttribute(string attributeName) { MarkupAttribute retval = null; foreach (MarkupAttribute a in attributes) { if (a.Name.Equals(attributeName, document.StringComparison)) { retval = a; break; } } return(retval); }
/// <summary> /// Attempts to get the attribute of the supplied name. /// </summary> /// <param name="attributeName">The name of the desired attributes.</param> /// <param name="attribute">The attribute parameter that will be filled by the operation.</param> /// <returns>True or false to indicate success or failure.</returns> public bool TryGetAttribute(string attributeName, out MarkupAttribute attribute) { attribute = GetAttribute(attributeName); return(attribute != null); }