add

Tuesday, March 17, 2009

.NET NameValueCollection DataTypes

A NameValueCollection is similar to a .NET Hash Table in that it can store items in key/value pairs and allows you to retrieve items by specifying either the Key or index. In fact, NameValueCollections use the hash table and hash table algorithms for their underlying data structures.

Unlike a hash table that can store any type of object as its key or value, NameValueCollections can only store string values. However, a NameValueCollection can store multiple strings values for each key. Because NameValueCollections use the hash table algorithms, they are slower performance wise than hash tables.

A NameValueCollection also has methods to return a collection of all keys, all values, add and remove items and to get an enumerator so you can enumerate through the collection.

No comments: