public void WriteXml(XmlWriter writer)
        {
            Type type = m_data.GetType();

            {
                CustomRootWriter customWriter;
                WriterPool.AllocateOrCreate(out customWriter);
                var derivedName = MyObjectBuilderSerializer.GetSerializedName(type);
                customWriter.Init(derivedName, writer);

                MyObjectBuilderSerializer.GetSerializer(type).Serialize(customWriter, m_data);

                customWriter.Release();
                WriterPool.Deallocate(customWriter);
            }
        }
Пример #2
0
        public void WriteXml(XmlWriter writer)
        {
            Type type = m_data.GetType();

            XmlSerializer    serializer  = MyXmlSerializerManager.GetOrCreateSerializer(type);
            var              derivedName = MyXmlSerializerManager.GetSerializedName(type);
            CustomRootWriter customWriter;

            WriterPool.AllocateOrCreate(out customWriter);
            customWriter.Init(derivedName, writer);

            serializer.Serialize(customWriter, m_data);

            customWriter.Release();
            WriterPool.Deallocate(customWriter);
        }