public void WriteXml(string filename) { try { XmlSerializer serializer = new XmlSerializer(typeof(FlipTemplateDb)); TextWriter writer = new StreamWriter(filename); FlipTile tile = new FlipTile(); tile.BackBackgroundImage = "BackBackgroundImage"; tile.BackContent = "BackContent"; tile.BackgroundImage = "BackgroundImage"; tile.BackTitle = "BackTitle"; tile.Count = 10; tile.SmallBackgroundImage = "SmallBackgroundImage"; tile.WideBackBackgroundImage = "WideBackBackgroundImage"; tile.WideBackContent = "WideBackContent"; tile.WideBackgroundImage = "WideBackgroundImage"; FlipTemplateDb mDb = new FlipTemplateDb(); FlipTile[] flipTiles = { tile, tile }; mDb.Tiles = flipTiles; // Serializes the purchase order, and closes the TextWriter. serializer.Serialize(writer, mDb); writer.Close(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }