simple serializable

[Serializable] public class TDI { public int Id { get; set; } public DateTime? CloseDate { get; set; } public DateTime? ResolvedDate { get; set; } public string Status { get; set; } } tdis = query.DatastoreItems.Cast<DatastoreItem>().Select(x => new TDI() { Id = x.ID, CloseDate = (DateTime?)x.Fields["Closed Date"].Value, ResolvedDate = (DateTime?)x.Fields["Resolved Date"].Value, Status = x.Fields["Status"].Value.ToString() }).ToArray(); XmlSerializer xml = new XmlSerializer(typeof(TDI[])); FileStream f = new FileStream("tdi.xml", FileMode.CreateNew); xml.Serialize(f, tdis); f.Close(); FileStream f = new FileStream("tdi.xml", FileMode.Open); TDI[] tdis = xml.Deserialize(f) as TDI[];

你可能感兴趣的:(xml,Date,String,Class)