There are other questions such as KeyValuePair vs IDictionary, but I feel this one differs slightly.
NameValueCollection
takes a string key and string value.
KeyValuePair
is like a dictionary, you tell it what type the key and value is.
I don't understand why NameValueCollection
exists. Initializing a KeyValuePair
with string types seems sufficient. I also noticed that NameValueCollection
has some more methods available to it, but again why not merge both classes into one?