static public void Test(CreateManufactoryOrder createManufacturyOrder) { StreamWriter writer = new StreamWriter(FILENAME); XmlSerializer serializer = new XmlSerializer(typeof(CreateManufactoryOrder)); serializer.Serialize(writer, createManufacturyOrder); writer.Flush(); writer.Close(); writer.Dispose(); string XML = File.ReadAllText(FILENAME); using (TextReader reader = new StringReader(XML)) { CreateManufactoryOrder result = (CreateManufactoryOrder)serializer.Deserialize(reader); } }
static void Main(string[] args) { CreateManufactoryOrder createManufacturyOrder = new CreateManufactoryOrder() { op = new Op() { auth = new Auth() { user = "******", password = "******" }, client = "01425787000104", downLoadCode = "0460.0001", partNumber = "M268-773-C4-BRA-3", flexPO = "887614_364", terminals = new List <Terminal>() { new Terminal() { m_String = "529-995-835" }, new Terminal() { m_String = "529-995-836" }, new Terminal() { m_String = "529-995-837" }, new Terminal() { m_String = "529-995-838" } } } }; Test(createManufacturyOrder); }