Beispiel #1
0
        static void Main(string[] args)
        {
            string[]     strings = { "Hello", "world" };
            MyBodyWriter bw      = new MyBodyWriter(strings);

            StringBuilder       strBuilder       = new StringBuilder(10);
            XmlWriter           writer           = XmlWriter.Create(strBuilder);
            XmlDictionaryWriter dictionaryWriter = XmlDictionaryWriter.CreateDictionaryWriter(writer);

            bw.WriteBodyContents(dictionaryWriter);
            dictionaryWriter.Flush();
        }
Beispiel #2
0
        public static void Snippet2()
        {
            // <Snippet2>
            string[]     strings    = { "Hello", "world" };
            MyBodyWriter bodyWriter = new MyBodyWriter(strings);

            StringBuilder       strBuilder       = new StringBuilder(10);
            XmlWriter           writer           = XmlWriter.Create(strBuilder);
            XmlDictionaryWriter dictionaryWriter = XmlDictionaryWriter.CreateDictionaryWriter(writer);

            bodyWriter.WriteBodyContents(dictionaryWriter);
            dictionaryWriter.Flush();

            MyBodyWriter bufferedBodyWriter = (MyBodyWriter)bodyWriter.CreateBufferedCopy(1024);
            // </Snippet2>
        }