Пример #1
0
        public async Task Save(IAssemblyMetadata toSave)
        {
            SerializationAssemblyMetadata graph = toSave as SerializationAssemblyMetadata
                                                  ?? new SerializationAssemblyMetadata(toSave);
            XmlWriterSettings settings = new XmlWriterSettings {
                Indent = true
            };

            if (SerializationStream != null)
            {
                SerializationStream.Position = 0;
                using (XmlWriter writer = XmlWriter.Create(SerializationStream, settings))
                {
                    dataContractSerializer.WriteObject(writer, graph);
                }

                await SerializationStream.FlushAsync();
            }
        }