private static string GetNamespaceXml(CustomAttribute customAttribute, string defaultName) { var namespaceProperty = customAttribute.GetStringProperty(XmlAttributeConstants.Namespace); if (namespaceProperty != null) { return namespaceProperty; } return defaultName; }
private static string GetElementName(CustomAttribute customAttribute, string defaultName) { var nameProperty = customAttribute.GetStringProperty(XmlAttributeConstants.ElementName); if (nameProperty != null) { return nameProperty; } switch (customAttribute.Constructor.ToString()) { case "System.Void System.Xml.Serialization.XmlElementAttribute::.ctor(System.String)": return customAttribute.ConstructorArguments[0].Value as string; case "System.Void System.Xml.Serialization.XmlElementAttribute::.ctor(System.String,System.Type)": return customAttribute.ConstructorArguments[0].Value as string; case "System.Void System.Xml.Serialization.XmlArrayItemAttribute::.ctor(System.String)": return customAttribute.ConstructorArguments[0].Value as string; case "System.Void System.Xml.Serialization.XmlArrayItemAttribute::.ctor(System.String,System.Type)": return customAttribute.ConstructorArguments[0].Value as string; } return defaultName; }