0
我想用下面的代碼的XPathNavigator引發錯誤引發NotSupportedException
private static bool ResetUpdateVersion()
{
// this indicate either the verwsion is different or not
// this will either call the update only or writting the defualt
bool Result = false;
//// check for version using xpath
XPathNavigator navigator = document.CreateNavigator();
//ShortcutList is the main element that contain all the other elements
XPathNavigator node = navigator.SelectSingleNode(@"/ShortcutList");
XmlNamespaceManager ns = new XmlNamespaceManager(navigator.NameTable);
if (node != null)
{
if (node.GetAttribute("Version", ns.DefaultNamespace) != Version)
{
node = navigator.SelectSingleNode(@"/ShortcutList/@Version");
node.SetValue(Version);
Result = true;
}
else
{
Result = false;
}
}
return Result;
}
更新的XDocument,但上線node.SetValue(Version);
提高NotSupportedException異常,我不知道爲什麼,任何想法來解決
什麼是版本?它在哪裏定義? – FailedDev