Hi Ray,
here you gou:
foreach (XmlNode node in xmlDocumentObj ["configuration"]
["appSettings"].ChildNodes)
{
// you can use 'node' here
}
BUT I would not recommand that type of iteration. You should first set the
XmlNodeList and do the iteration stuff with the new instance:
XmlNode configuration = xmlDocumentObj ["configuration"];
XmlNode appSettings = null;
XmlNodeList allSettigns = null;
if (configuration != null)
{
appSettings = configuration ["appSettings"];
if (appSetrings != null && appSettings.HasChildNodes)
{
allSettings = appSettings.ChildNodes;
foreach (XmlNode node in allSettings)
{
// your code goes here
}
}
}
Hope that helps
Patrick
Ray5531 said:
Sorry here is what I want to convert to C#:
For Each Node In XmlDocument.Item("configuration").Item("appSettings")
Ray5531 said:
what is the equivalent of this in C# ?
foreach (XmlNode xmlConfigNode in
xmlConfigDoc["configuration"].ChildNodes)
Thansk