System.Xml.Serialization.XmlAttributes.GetAttr C# (CSharp) Method

GetAttr() static private method

static private GetAttr ( ICustomAttributeProvider provider, Type attrType ) : object
provider ICustomAttributeProvider
attrType System.Type
return object
        internal static object GetAttr(ICustomAttributeProvider provider, Type attrType) {
            object[] attrs = provider.GetCustomAttributes(attrType, false);
            if (attrs.Length == 0) return null;
            return attrs[0];
        }
        

Usage Example

Example #1
0
 internal static string GenerateKey(Type type, XmlRootAttribute root, string ns)
 {
     if (root == null)
     {
         root = (XmlRootAttribute)XmlAttributes.GetAttr(type.GetTypeInfo(), typeof(XmlRootAttribute));
     }
     return(type.FullName + ":" + (root == null ? String.Empty : root.Key) + ":" + (ns == null ? String.Empty : ns));
 }
All Usage Examples Of System.Xml.Serialization.XmlAttributes::GetAttr