This collection is based on the NameObjectCollectionBase class. However, unlike the NameObjectCollectionBase, this class stores multiple string values under a single key.
This class can be used for headers, query strings and form data.
Each element is a key/value pair.
The capacity of a NameValueCollection is the number of elements the NameValueCollection can hold. As elements are added to a NameValueCollection, the capacity is automatically increased as required through reallocation.
The hash code provider dispenses hash codes for keys in the NameValueCollection. The default hash code provider is the CaseInsensitiveHashCodeProvider.
The comparer determines whether two keys are equal. The default comparer is the CaseInsensitiveComparer.
In .NET Framework version 1.0, this class uses culture-sensitive string comparisons. However, in .NET Framework version 1.1 and later, this class uses CultureInfo..::.InvariantCulture when comparing strings. For more information about how culture affects comparisons and sorting, see Comparing and Sorting Data for a Specific Culture Comparing and Sorting Data for a Specific Cultureand Performing Culture-Insensitive String Operations.
nullNothingnullptra null reference (Nothing in Visual Basic) is allowed as a key or as a value.
Caution: |
|---|
The Get method does not distinguish between nullNothingnullptra null reference (Nothing in Visual Basic) which is returned because the specified key is not found and nullNothingnullptra null reference (Nothing in Visual Basic) which is returned because the value associated with the key is nullNothingnullptra null reference (Nothing in Visual Basic). |