It is written that
"
There is a difference between the NameValueConfigurationElement class and KeyValueConfigurationElement class. The NameValueConfigurationElement class does not require the first string to be unique, whereas KeyValueConfigurationElement class requires the first string to be a key, and therefore unique in the collection.
"
However when I try to test it, it seems that
- NameValue also can not display duplicate Names in the collection moreover if the name is the same but the value is different , it will throw an error message which says that name has already has the value.
- On the other hand KeyPair, also can not have duplicate keys but if there is duplicate key but different values, it will be override with the last values. There is no error message return.
- KeyPair collection will be sorted , I guess it similar with Hashtable collection but NameValue is not sorted.
- KeyPair is case sensitive so Key1 and key1 will be consider the same key
but Namevalue is incase sensitive Name1 and name1 will be consider different name
For solving this problem, I have build my custom collection - can be downloaded at
http://kkurni.googlepages.com/KKurni.CustomConfigurationElementCol.rar
No comments:
Post a Comment