System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.XmlObjectSerializerReadContextComplexJson.ReadPrimitiveExtensionDataValue C# (CSharp) Method

ReadPrimitiveExtensionDataValue() protected method

protected ReadPrimitiveExtensionDataValue ( System.Runtime.Serialization.XmlReaderDelegator xmlReader, string dataContractName, string dataContractNamespace ) : IDataNode
xmlReader System.Runtime.Serialization.XmlReaderDelegator
dataContractName string
dataContractNamespace string
return IDataNode
        protected override IDataNode ReadPrimitiveExtensionDataValue(XmlReaderDelegator xmlReader, string dataContractName, string dataContractNamespace)
        {
            IDataNode dataNode;

            switch (_extensionDataValueType)
            {
                case null:
                case JsonGlobals.stringString:
                    dataNode = new DataNode<string>(xmlReader.ReadContentAsString());
                    break;
                case JsonGlobals.booleanString:
                    dataNode = new DataNode<bool>(xmlReader.ReadContentAsBoolean());
                    break;
                case JsonGlobals.numberString:
                    dataNode = ReadNumericalPrimitiveExtensionDataValue(xmlReader);
                    break;
                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                        XmlObjectSerializer.CreateSerializationException(SR.Format(SR.JsonUnexpectedAttributeValue, _extensionDataValueType)));
            }

            xmlReader.ReadEndElement();
            return dataNode;
        }