Пример #1
0
 public override System.Threading.Tasks.Task WriteToStreamAsync(Type type, object value, System.IO.Stream stream, System.Net.Http.Headers.HttpContentHeaders contentHeaders, System.Net.TransportContext transportContext)
 {
     if (type != null)
     {
         if (stream != null)
         {
             return(Task.Factory.StartNew(() =>
             {
                 using (var writer = System.Xml.XmlWriter.Create(stream))
                 {
                     var r = new HalXmlResource(value);
                     r.XmlDocument.WriteTo(writer);
                 }
             }));
         }
         else
         {
             throw new System.ArgumentNullException("stream");
         }
     }
     else
     {
         throw new System.ArgumentNullException("type");
     }
 }
 public override System.Threading.Tasks.Task WriteToStreamAsync(Type type, object value, System.IO.Stream stream, System.Net.Http.Headers.HttpContentHeaders contentHeaders, System.Net.TransportContext transportContext)
 {
     if (type != null)
         if (stream != null)
         {
             return Task.Factory.StartNew(() =>
             {
                 using (var writer = System.Xml.XmlWriter.Create(stream))
                 {
                     var r = new HalXmlResource(value);
                     r.XmlDocument.WriteTo(writer);
                 }
             });
         }
         else
         {
             throw new System.ArgumentNullException("stream");
         }
     else
     {
         throw new System.ArgumentNullException("type");
     }
 }