est-il un moyen d'obtenir le InnerText d'un nœud lorsque le nœud se trouve dans une collection j'ai actuellement ceGet InnerText de Collection
Collection<string> DependentNodes = new Collection<string>();
foreach (XmlNode node in nodes)
{
for (int i = 0; i < node.ChildNodes.Count; i++)
{
DependentNodes.Add(node.ChildNodes[i].InnerXml);
//the reason i'm using InnerXml is that it will return all the child node of testfixture in one single line,then we can find the category & check if there's dependson
}
}
string selectedtestcase = "abc_somewords";
foreach (string s in DependentNodes)
{
if(s.Contains(selectedtestcase))
{
MessageBox.Show("aaa");
}
}
Quand je déboguer chaîne s ou l'indice a ceci à l'intérieur de celui-ci [en une seule ligne]
<testfixture name="1" description="a">
<categories>
<category>abc_somewords</category>
</categories>
<test name="a" description="a">
<dependencies>
<dependson typename="dependsonthis" />
</dependencies>
</test>
</testfixture>
ce que je suis en train de faire est lorsque nous atteignons « TestFixture 1 » il trouvera « abc_somewords » & rechercher le noeud « DependsOn typename » (le cas échéant) et obtenir le " typename "(qui est" dependonthis ").
quel type est 'DependentNodes'? – Stefan
Dependentnode est une collection – someguy
Pouvez-vous utiliser Linq? –