0
我有模式:xmlconvert字符串到日期
[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 {獲取;集;}到DatiTime:
public DateTime startDate { get{return startDate;} set{startDate. = DateTime.Parse(startDate);}}
我怎麼能這樣做?
例外:字符串「星期五,2012年03月30 20時00分00秒'不是有效的AllXsd值。 – Evgeniy 2012-03-27 14:24:59
@Evg,看我更新的答案 – 2012-03-27 14:29:59
很酷的把戲!謝謝! – Evgeniy 2012-03-27 15:10:08