示例 XML 文件
<SiEventSchedule deleteStart="2012/01/21 00:00:00" deleteEnd="2012/01/21 23:59:59">
</SiEventSchedule>
代码:
var el = doc.Descendants(ns + "SiEventSchedule").Select(x => x.Attribute("deleteStart").Value).First();
string[] s = el.ToString().Split(' ');
s[0] = today.ToString("yyyy/MM/dd");
String s5 = String.Join(" ", s);
el.Replace(el, s5); // This line is not working
只有代码的最后一行不起作用,其他一切都在起作用。谁能建议如何更新这个值?
<SiEventSchedule deleteStart="2012/01/21 00:00:00" deleteEnd="2012/01/21 23:59:59">
</SiEventSchedule>