Esempio n. 1
0
 public XMLOrder(Guid id, DateTime date, XMLProduct product, int quantity)
 {
     this._orderID   = id;
     this._orderDate = date;
     this._product   = product;
     this._quantity  = quantity;
 }
Esempio n. 2
0
 public XMLOrder(Guid id, DateTime date, XMLProduct product, int quantity)
 {
     this._orderID = id;
     this._orderDate = date;
     this._product = product;
     this._quantity = quantity;
 }
Esempio n. 3
0
 static void SerializeViaXMLSerializer()
 {
     XMLProduct product = new XMLProduct(Guid.NewGuid(), "Dell PC", "Xiamen FuJian", 4500);
     XMLOrder order = new XMLOrder(Guid.NewGuid(), DateTime.Today, product, 300);
     string fileName = _basePath + "Order.XmlSerializer.xml";
     using (FileStream fs = new FileStream(fileName, FileMode.Create))
     {
         XmlSerializer serializer = new XmlSerializer(typeof(XMLOrder));
         using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(fs))
         {
             serializer.Serialize(writer, order);
         }
     }
     Process.Start(fileName);
 }
Esempio n. 4
0
        static void SerializeViaXMLSerializer()
        {
            XMLProduct product  = new XMLProduct(Guid.NewGuid(), "Dell PC", "Xiamen FuJian", 4500);
            XMLOrder   order    = new XMLOrder(Guid.NewGuid(), DateTime.Today, product, 300);
            string     fileName = _basePath + "Order.XmlSerializer.xml";

            using (FileStream fs = new FileStream(fileName, FileMode.Create))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(XMLOrder));
                using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(fs))
                {
                    serializer.Serialize(writer, order);
                }
            }
            Process.Start(fileName);
        }