public virtual bool FromXml(Stream a_oStream) { DataContractSerializer _oSerializer = new DataContractSerializer(typeof(T), XmlStorageTypes.GetArray()); using var _oReader = XmlDictionaryReader.CreateTextReader(a_oStream, new XmlDictionaryReaderQuotas()); return(InitializeFromObject((T)_oSerializer.ReadObject(_oReader, false))); }
public virtual MemoryStream ToXml() { DataContractSerializer _oSerializer = new DataContractSerializer(typeof(T), XmlStorageTypes.GetArray()); using var _oStream = new MemoryStream(); using var _oWriter = XmlDictionaryWriter.CreateTextWriter(_oStream, Encoding.UTF8); _oSerializer.WriteObject(_oWriter, this); return(_oStream); }