Exemplo n.º 1
0
 public static DeliveryRequest From(byte[] deliveryRequestData)
 {
     using (MemoryStream stream = new MemoryStream(deliveryRequestData))
     {
         DataContractSerializer serializer      = new DataContractSerializer(typeof(DeliveryRequest));
         DeliveryRequest        deliveryRequest = (DeliveryRequest)serializer.ReadObject(stream);
         return(deliveryRequest);
     }
 }
Exemplo n.º 2
0
 public static byte[] ToByteArray(this DeliveryRequest deliveryRequest)
 {
     using (MemoryStream stream = new MemoryStream())
     {
         DataContractSerializer serializer = new DataContractSerializer(typeof(DeliveryRequest));
         serializer.WriteObject(stream, deliveryRequest);
         return(stream.ToArray());
     }
 }