Recently I ran across a need for a collection of name / value objects that I could use in JSON and pass up to my MVC Web API. The problem I ran into is that the NameValueCollection object that is in the Collections.Specialized namespace does not deserialize correctly.
After much searching into the matter I came to find out that it wasn’t the way I was using it but that it didn’t play nicely with serialization into JSON even though it is a serializable object. When you serialize it to JSON all you receive back are the values. This became a problem for the deserialization of the object as well. It obviously wasn’t going to work, so after a quick trip back to the drawing board I decided to make my own set of classes to mimic a NameValueCollection object. Continue reading »