System.Xml.Serialization.XmlReflectionImporter.ImportConstantMapping C# (CSharp) Method

ImportConstantMapping() private method

private ImportConstantMapping ( ConstantModel model ) : ConstantMapping
model ConstantModel
return ConstantMapping
        private ConstantMapping ImportConstantMapping(ConstantModel model)
        {
            XmlAttributes a = GetAttributes(model.FieldInfo);
            if (a.XmlIgnore) return null;
            if ((a.XmlFlags & ~XmlAttributeFlags.Enum) != 0)
                throw new InvalidOperationException(SR.XmlInvalidConstantAttribute);
            if (a.XmlEnum == null)
                a.XmlEnum = new XmlEnumAttribute();

            ConstantMapping constant = new ConstantMapping();
            constant.XmlName = a.XmlEnum.Name == null ? model.Name : a.XmlEnum.Name;
            constant.Name = model.Name;
            constant.Value = model.Value;
            return constant;
        }