防止组合框中的值重复 [英] to prevent duplicate values in combo box
本文介绍了防止组合框中的值重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
这是问题!
我必须从xml读取组合框中的值,而不必复制来自根节点的不同子节点的任何值..我该怎么做?
thnx ...
hi all ,
here is the question !
I have to read values in the combo box from an xml without duplicating any value coming from different child nodes of the root node .. .how can i do this ?
thnx ...
推荐答案
为什么似乎有问题?
这是XML不同解析方法的概述:
Why it seems to be a problem?
Here is the overview of XML different parsing approaches:
- 使用
System.Xml.XmlDocument
类.它实现了DOM接口;如果文档太大,则这种方法最简单,也足够好.
请参见- 使用类
].System.Xml.XmlTextReader
; library/system.xml.xmldocument.aspx"target =" _ blank"title =" New Window> ^ - 使用类
- 使用类
System.Xml.XmlTextReader
;这是最快的读取方法,尤其是您需要跳过一些数据.
请参见 http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx [ http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx [http://msdn.microsoft.com/en-us/library/bb387063.aspx [
- Use
System.Xml.XmlDocument
class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^]. - Use the class
System.Xml.XmlTextReader
; this is the fastest way of reading, especially is you need to skip some data.
See http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx[^]. - Use the class
System.Xml.Linq.XDocument
; this is the most adequate way similar to that ofXmlDocument
, supporting LINQ to XML Programming.
See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^], http://msdn.microsoft.com/en-us/library/bb387063.aspx[^].
为防止重复,请使用System.Collections.Generic.Dictionary
;它支持唯一键;请参阅 http://msdn.microsoft.com/en-us/library /xfhwa508%28v=VS.100%29.aspx [ ^ ].
To prevent duplication, use System.Collections.Generic.Dictionary
; it supports unique keys; see http://msdn.microsoft.com/en-us/library/xfhwa508%28v=VS.100%29.aspx[^].
这篇关于防止组合框中的值重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文