Ejemplo n.º 1
0
        private void saveSwag_Click(object sender, EventArgs e)
        {
            var swags = SwagCollection.Create();

            foreach (DataGridViewRow swagRow in swagGrid.Rows)
            {
                if (swagRow.Cells[0].Value != null && swagRow.Cells[1].Value != null)
                {
                    swags.Add(new Swag {
                        Company = swagRow.Cells[0].Value.ToString(), Thing = swagRow.Cells[1].Value.ToString()
                    });
                }
            }
            using (var fs = File.Open(GetPathFor("Swag.xml"), FileMode.Truncate, FileAccess.Write))
            {
                new XmlSerializer(typeof(SwagCollection)).Serialize(fs, swags);
            }
        }
Ejemplo n.º 2
0
 protected override IThingCollection <SwagBase> GetCollection()
 {
     return(SwagCollection.Create());
 }