我有模型:
[XmlRoot(ElementName = "event", IsNullable=true)]
public class Event
{
public int id { get; set; }
public string title { get; set; }
public eventArtists artists { get; set; }
public venue venue { get; set; }
public string startDate { get;set;}
public string description { get; set; }
[XmlElement("image")]
public List<string> image { get; set; }
public int attendance { get; set; }
public int reviews { get; set; }
public string url { get; set; }
public string website { get; set; }
public string tickets { get; set; }
public int cancelled { get; set; }
[XmlArray(ElementName="tags")]
[XmlArrayItem(ElementName="tag")]
public List<string> tags { get; set; }
}
现在我想将公共字符串 startDate { get;set;} 转换为 DatiTime:
public DateTime startDate { get{return startDate;} set{startDate. = DateTime.Parse(startDate);}}
我怎样才能做到这一点?