private static bool FindXmlAttribute <TAttribute>(PropertyCache propertyCache, List <XmlMapping> mappings, Type type, Func <TAttribute, string> name, XmlAttributeType enumType) where TAttribute : Attribute { var attributes = propertyCache.GetAttributes <TAttribute>(); if (attributes.Length > 0) { var attribs = attributes.Cast <TAttribute>(); mappings.Add(new XmlMapping(type, propertyCache, attribs.Select(name).ToArray(), enumType)); return(true); } return(false); }