Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Collections.​Specialized.​NameValueCollection
Assembly: System.Collections.Specialized
Inheritance: object → NameObjectCollectionBase → NameValueCollection
Implemented Interfaces
- ICollection (Inherits: IEnumerable) Implemented by: NameObjectCollectionBase
- Runtime.​Serialization.​IDeserializationCallback Implemented by: NameObjectCollectionBase
- Runtime.​Serialization.​ISerializable Implemented by: NameObjectCollectionBase
Represents a collection of associated <see cref="T:System.String" /> keys and <see cref="T:System.String" /> values that can be accessed either with the key or with the index.
Properties
public
string[]
AllKeys
Gets all the keys in the <see cref="T:System.Collections.Specialized.NameValueCollection" /> .
public
string
Item
public
string
Item
public
int
Count
Gets the number of key/value pairs contained in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
protected
bool
IsReadOnly
Gets or sets a value indicating whether the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance is read-only.
public
KeysCollection
Keys
Gets a <see cref="T:System.Collections.Specialized.NameObjectCollectionBase.KeysCollection" /> instance that contains all the keys in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
Methods
public
void
Add​(NameValueCollection c)
Copies the entries in the specified <see cref="T:System.Collections.Specialized.NameValueCollection" /> to the current <see cref="T:System.Collections.Specialized.NameValueCollection" /> .
c
The <see cref="T:System.Collections.Specialized.NameValueCollection" /> to copy to the current <see cref="T:System.Collections.Specialized.NameValueCollection" /> .
public
void
Add​(string name,
string value)
Adds an entry with the specified name and value to the <see cref="T:System.Collections.Specialized.NameValueCollection" /> .
name
The <see cref="T:System.String" /> key of the entry to add. The key can be <see langword="null" /> .
value
The <see cref="T:System.String" /> value of the entry to add. The value can be <see langword="null" /> .
public
void
Clear​()
Invalidates the cached arrays and removes all entries from the <see cref="T:System.Collections.Specialized.NameValueCollection" /> .
public
void
CopyTo​(Array dest,
int index)
Copies the entire <see cref="T:System.Collections.Specialized.NameValueCollection" /> to a compatible one-dimensional <see cref="T:System.Array" /> , starting at the specified index of the target array.
dest
The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Specialized.NameValueCollection" /> . The <see cref="T:System.Array" /> must have zero-based indexing.
index
The zero-based index in <paramref name="dest" /> at which copying begins.
public
string
Get​(int index)
Gets the values at the specified index of the <see cref="T:System.Collections.Specialized.NameValueCollection" /> combined into one comma-separated list.
Returns A <see cref="T:System.String" /> that contains a comma-separated list of the values at the specified index of the <see cref="T:System.Collections.Specialized.NameValueCollection" /> , if found; otherwise, <see langword="null" /> .
index
The zero-based index of the entry that contains the values to get from the collection.
public
string
Get​(string name)
Gets the values associated with the specified key from the <see cref="T:System.Collections.Specialized.NameValueCollection" /> combined into one comma-separated list.
Returns A <see cref="T:System.String" /> that contains a comma-separated list of the values associated with the specified key from the <see cref="T:System.Collections.Specialized.NameValueCollection" /> , if found; otherwise, <see langword="null" /> .
name
The <see cref="T:System.String" /> key of the entry that contains the values to get. The key can be <see langword="null" /> .
public
string
GetKey​(int index)
Gets the key at the specified index of the <see cref="T:System.Collections.Specialized.NameValueCollection" /> .
Returns A <see cref="T:System.String" /> that contains the key at the specified index of the <see cref="T:System.Collections.Specialized.NameValueCollection" /> , if found; otherwise, <see langword="null" /> .
index
The zero-based index of the key to get from the collection.
public
string[]
GetValues​(int index)
Gets the values at the specified index of the <see cref="T:System.Collections.Specialized.NameValueCollection" /> .
Returns A <see cref="T:System.String" /> array that contains the values at the specified index of the <see cref="T:System.Collections.Specialized.NameValueCollection" /> , if found; otherwise, <see langword="null" /> .
index
The zero-based index of the entry that contains the values to get from the collection.
public
string[]
GetValues​(string name)
Gets the values associated with the specified key from the <see cref="T:System.Collections.Specialized.NameValueCollection" /> .
Returns A <see cref="T:System.String" /> array that contains the values associated with the specified key from the <see cref="T:System.Collections.Specialized.NameValueCollection" /> , if found; otherwise, <see langword="null" /> .
name
The <see cref="T:System.String" /> key of the entry that contains the values to get. The key can be <see langword="null" /> .
public
bool
HasKeys​()
Gets a value indicating whether the <see cref="T:System.Collections.Specialized.NameValueCollection" /> contains keys that are not <see langword="null" /> .
Returns <see langword="true" /> if the <see cref="T:System.Collections.Specialized.NameValueCollection" /> contains keys that are not <see langword="null" /> ; otherwise, <see langword="false" /> .
protected
void
InvalidateCachedArrays​()
Resets the cached arrays of the collection to <see langword="null" /> .
public
void
Remove​(string name)
Removes the entries with the specified key from the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
name
The <see cref="T:System.String" /> key of the entry to remove. The key can be <see langword="null" /> .
public
void
Set​(string name,
string value)
Sets the value of an entry in the <see cref="T:System.Collections.Specialized.NameValueCollection" /> .
name
The <see cref="T:System.String" /> key of the entry to add the new value to. The key can be <see langword="null" /> .
value
The <see cref="T:System.Object" /> that represents the new value to add to the specified entry. The value can be <see langword="null" /> .
protected
void
BaseAdd​(string name,
object value)
Inherited from NameObjectCollectionBase
Adds an entry with the specified key and value into the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
name
The <see cref="T:System.String" /> key of the entry to add. The key can be <see langword="null" /> .
value
The <see cref="T:System.Object" /> value of the entry to add. The value can be <see langword="null" /> .
protected
void
BaseClear​()
Inherited from NameObjectCollectionBase
Removes all entries from the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
protected
object
BaseGet​(int index)
Inherited from NameObjectCollectionBase
Gets the value of the entry at the specified index of the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
Returns An <see cref="T:System.Object" /> that represents the value of the entry at the specified index.
index
The zero-based index of the value to get.
protected
object
BaseGet​(string name)
Inherited from NameObjectCollectionBase
Gets the value of the first entry with the specified key from the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
Returns An <see cref="T:System.Object" /> that represents the value of the first entry with the specified key, if found; otherwise, <see langword="null" /> .
name
The <see cref="T:System.String" /> key of the entry to get. The key can be <see langword="null" /> .
protected
string[]
BaseGetAllKeys​()
Inherited from NameObjectCollectionBase
Returns a <see cref="T:System.String" /> array that contains all the keys in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
Returns A <see cref="T:System.String" /> array that contains all the keys in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
protected
object[]
BaseGetAllValues​()
Inherited from NameObjectCollectionBase
Returns an <see cref="T:System.Object" /> array that contains all the values in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
Returns An <see cref="T:System.Object" /> array that contains all the values in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
protected
object[]
BaseGetAllValues​(Type type)
Inherited from NameObjectCollectionBase
Returns an array of the specified type that contains all the values in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
Returns An array of the specified type that contains all the values in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
type
A <see cref="T:System.Type" /> that represents the type of array to return.
protected
string
BaseGetKey​(int index)
Inherited from NameObjectCollectionBase
Gets the key of the entry at the specified index of the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
Returns A <see cref="T:System.String" /> that represents the key of the entry at the specified index.
index
The zero-based index of the key to get.
protected
bool
BaseHasKeys​()
Inherited from NameObjectCollectionBase
Gets a value indicating whether the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance contains entries whose keys are not <see langword="null" /> .
Returns <see langword="true" /> if the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance contains entries whose keys are not <see langword="null" /> ; otherwise, <see langword="false" /> .
protected
void
BaseRemove​(string name)
Inherited from NameObjectCollectionBase
Removes the entries with the specified key from the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
name
The <see cref="T:System.String" /> key of the entries to remove. The key can be <see langword="null" /> .
protected
void
BaseRemoveAt​(int index)
Inherited from NameObjectCollectionBase
Removes the entry at the specified index of the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
index
The zero-based index of the entry to remove.
protected
void
BaseSet​(int index,
object value)
Inherited from NameObjectCollectionBase
Sets the value of the entry at the specified index of the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
index
The zero-based index of the entry to set.
value
The <see cref="T:System.Object" /> that represents the new value of the entry to set. The value can be <see langword="null" /> .
protected
void
BaseSet​(string name,
object value)
Inherited from NameObjectCollectionBase
Sets the value of the first entry with the specified key in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance, if found; otherwise, adds an entry with the specified key and value into the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
name
The <see cref="T:System.String" /> key of the entry to set. The key can be <see langword="null" /> .
value
The <see cref="T:System.Object" /> that represents the new value of the entry to set. The value can be <see langword="null" /> .
public
IEnumerator
GetEnumerator​()
Inherited from NameObjectCollectionBase
Returns an enumerator that iterates through the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> .
Returns An <see cref="T:System.Collections.IEnumerator" /> for the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
public
void
GetObjectData​(Runtime.​Serialization.​SerializationInfo info,
Runtime.​Serialization.​StreamingContext context)
Inherited from NameObjectCollectionBase
Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and returns the data needed to serialize the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
info
A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains the information required to serialize the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
context
A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object that contains the source and destination of the serialized stream associated with the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase" /> instance.
public
void
OnDeserialization​(object sender)
Inherited from NameObjectCollectionBase
Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and raises the deserialization event when the deserialization is complete.
sender
The source of the deserialization event.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object