这在 intel-sense 中返回了正确的元素原因,nexp 读取如下脱机我正在尝试将具有脱机值的元素更改为就绪。
public void ChangeConnectionStatus(string SelectedFile)
{
System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(@"C:\Users\Rick\Documents\Visual Studio 2010\Projects\Server\server.config\DC_Classes\");
//Getting All file names from the directory info
System.IO.FileInfo[] fileNames = dirInfo.GetFiles(SelectedFile + "*.xml*");
//Foreach itterator
foreach (System.IO.FileInfo fi in fileNames)
{
XElement main = XElement.Load(fi.FullName);
IEnumerable<XElement> Nongroups = from nexp in main.XPathSelectElements("Network/Posted_Status")
where nexp.Element("Posted_Status").Value == "Offline"
select nexp;
////Handle the process here
foreach (XElement nexp in Nongroups)
{
DialogResult Yes = MessageBox.Show("This Will Online This Group Are You Sure You Want To Do This","System Info",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
if (Yes == DialogResult.Yes)
{
nexp.SetValue("Ready");
}
}
}
}