public XmlReaderDelegator(XmlReader reader) { ArgumentNullException.ThrowIfNull(reader); this.reader = reader; this.dictionaryReader = reader as XmlDictionaryReader; }
public void XmlDictionaryWriterReaderNonGenericNullTest() { TestModel? testModel = null; XmlDictionaryWriter?write = null; XmlDictionaryReader?reader = null; testModel.Serialize(typeof(TestModel), write); write.WriteXml(typeof(TestModel), testModel); reader.ReadXml(typeof(TestModel)); }
public void XmlDictionaryWriterReaderNullTest() { TestModel? testModel = null; XmlDictionaryWriter?write = null; XmlDictionaryReader?reader = null; testModel.Serialize(write); write.WriteXml(testModel); reader.ReadXml <TestModel>(); }
public override void WriteNode(XmlReader reader, bool defattr) { XmlDictionaryReader?dictionaryReader = reader as XmlDictionaryReader; if (dictionaryReader != null) { WriteNode(dictionaryReader, defattr); } else { base.WriteNode(reader, defattr); } }
public XmlReaderDelegator(XmlReader reader) { XmlObjectSerializer.CheckNull(reader, nameof(reader)); this.reader = reader; this.dictionaryReader = reader as XmlDictionaryReader; }
public static object?ReadXml(this XmlDictionaryReader?xmlDictionaryReader, Type type) => DataContractHelper.Deserialize(type, xmlDictionaryReader);
public static TValue?ReadXml <TValue>(this XmlDictionaryReader?xmlDictionaryReader) => DataContractHelper.Deserialize <TValue>(xmlDictionaryReader);
/// <summary> /// Deserializes the XML document contained by the specified XmlReader. /// </summary> /// <param name="xmlDictionaryReader"></param> /// <param name="verifyObjectName"></param> /// <param name="dataContractResolver"></param> /// <typeparam name="TValue"></typeparam> /// <returns></returns> public static TValue?Deserialize <TValue>(XmlDictionaryReader?xmlDictionaryReader, bool verifyObjectName = true, DataContractResolver?dataContractResolver = null) => xmlDictionaryReader is null ? default : (TValue?)Deserialize(typeof(TValue), xmlDictionaryReader, verifyObjectName, dataContractResolver);