title: How to use protobuf-net for xml-serialization?
body: <p>Maybe i misunderstood something for serialization. i wanna serialize my .net object fastest way. i made some googling i found protobuf. Myfirstquestion is ProtoBuf.Net has avility for xml serailization.if it has, can i use it for xml serialization.</p>
  
  <p>My model:</p>
  
  <pre><code>
      [XmlType]
  public class CT {
      [XmlElement(Order = 1)]
      public int Foo { get; set; }
  }
  [XmlType]
  public class TE {
      [XmlElement(Order = 1)]
      public int Bar { get; set; }
  }
  [XmlType]
  public class TD {
      [XmlElement(Order = 1)]
      public List CTs { get; set; }
      [XmlElement(Order = 2)]
      public List TEs { get; set; }
      [XmlElement(Order = 3)]
      public string Code { get; set; }
      [XmlElement(Order = 4)]
      public string Message { get; set; }
      [XmlElement(Order = 5)]
      public DateTime StartDate { get; set; }
      [XmlElement(Order = 6)]
      public DateTime EndDate { get; set; }
  }
  </code></pre>
  
  <p>my serializer : </p>
  
  <pre><code>            CT ct = new CT() { Foo = 1 };
          List&lt;CT&gt; list = new List&lt;CT&gt;();
          list.Add(ct);
          TE te = new TE() { Bar = 2 };
          List&lt;TE&gt; list2 = new List&lt;TE&gt;();
          list2.Add(te);
          TD td = new TD() { Code = "Test",Message = "Yusuf",StartDate = DateTime.Now,EndDate = DateTime.Now,CTs = list,TEs = list2 };
          List&lt;TD&gt; list3 = new List&lt;TD&gt;();
          list3.Add(td);
          Stopwatch stopwatch5 = new Stopwatch();
          stopwatch5.Start();
  
          string str = String.Empty;
               using (MemoryStream stream = new MemoryStream()) 
          {
              byte[] data =  Serialize(list3);
              XmlDocument doc = new XmlDocument();
              string xml = Encoding.UTF8.GetString(data); &lt;--SHOULD CREATE XML
              doc.LoadXml(xml);
             // str = Convert.ToBase64String(stream.GetBuffer(),0,(int)stream.Length); 
          } 
          stopwatch5.Stop();
          Console.WriteLine(((double)(stopwatch5.Elapsed.TotalMilliseconds * 1000000) / 1000000).ToString("0.00 ns"));
          Console.Read();
  
      }
      public static byte[] Serialize(List&lt;TD&gt; tData) {
          using(var ms = new MemoryStream()) {
              ProtoBuf.Serializer.Serialize(ms,tData);
              return ms.ToArray();
          }
      }
  
      public static List&lt;TD&gt; Deserialize(byte[] tData) {
          using(var ms = new MemoryStream(tData)) {
              return ProtoBuf.Serializer.Deserialize&lt;List&lt;TD&gt;&gt;(ms);
          }
      }
  </code></pre>
  
  <p>it should create xml as a result of "   string xml = Encoding.UTF8.GetString(data);". But doesn't. How can i produxe xml result?</p>