public dynamic this[XName name] { get { if (name == null) { throw new ArgumentNullException("name"); } var attribute = InnerElement.Attribute(name); if (attribute == null) { throw new InvalidOperationException(string.Format("Attribute '{0}' not found in element '{1}'", name, InnerElement.Name)); } return(DynamicXAttribute.CreateInstance(attribute)); } }