第一次编辑
我正在将 Child 1 标签提取到我的 C# 表单中的 DropDownList 中,请建议最佳实践代码 (C#) 以删除 XML 文件中的特定父标签及其所有子标签。
我的 xml 文件示例:
<Parents>
<Parent>
<Child 1>Something</Child 1>
<Child 2>Something</Child 2>
<Child 3>Something</Child 3>
<Child 4>Something</Child 4>
</Parent>
<Parent>
<Child 1>Something 1</Child 1>
<Child 2>Something 1</Child 2>
<Child 3>Something 1</Child 3>
<Child 4>Something 1</Child 4>
</Parent>
</Parents>
我的意思是:
for (int i=0; i<[Length of xml doc]; i++)
{
if (Child 1 == ComboBox1.Text && Child 2 == richTextBox1.Text)
// Delete <Parent> tag of that Child 1
}
最佳答案
关于c# - 使用 C# 删除 XML 标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2515344/