Пример #1
0
        /// <summary>
        /// Provides example code for the Save(Stream) method
        /// </summary>
        public static void SaveStreamExample()
        {
            BlogMLDocument document = new BlogMLDocument();

            //  Modify document state using public properties and methods

            using (Stream stream = new FileStream("BlogMLDocument.xml", FileMode.Create, FileAccess.Write))
            {
                document.Save(stream);
            }
        }
 private void WriteFile(BlogMLDocument blogMlDoc)
 {
     using (var stream = new MemoryStream())
     {
         blogMlDoc.Save(stream, new SyndicationResourceSaveSettings()
         {
             CharacterEncoding = Encoding.UTF8
         });
         stream.Position = 0;
         _fileSystem.AddFile("BlogMlExport.xml", stream, true);
     }
 }
Пример #3
0
        /// <summary>
        /// Provides example code for the Save(XmlWriter) method
        /// </summary>
        public static void SaveXmlWriterExample()
        {
            BlogMLDocument document = new BlogMLDocument();

            //  Modify document state using public properties and methods

            using (Stream stream = new FileStream("BlogMLDocument.xml", FileMode.Create, FileAccess.Write))
            {
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent = true;

                using (XmlWriter writer = XmlWriter.Create(stream, settings))
                {
                    document.Save(writer);
                }
            }
        }