NameValueCollection.GetValues Method

Definition

Gets the values of a specified entry in the NameValueCollection.

Overloads

GetValues(Int32)

Gets the values at the specified index of the NameValueCollection.

GetValues(String)

Gets the values associated with the specified key from the NameValueCollection.

GetValues(Int32)

Gets the values at the specified index of the NameValueCollection.

public:
 virtual cli::array <System::String ^> ^ GetValues(int index);
public virtual string[] GetValues (int index);
abstract member GetValues : int -> string[]
override this.GetValues : int -> string[]
Public Overridable Function GetValues (index As Integer) As String()

Parameters

index
Int32

The zero-based index of the entry that contains the values to get from the collection.

Returns

String[]

A String array that contains the values at the specified index of the NameValueCollection, if found; otherwise, null.

Exceptions

index is outside the valid range of indexes for the collection.

Remarks

This method is an O(n) operation, where n is the number of values at the specified index.

See also

GetValues(String)

Gets the values associated with the specified key from the NameValueCollection.

public:
 virtual cli::array <System::String ^> ^ GetValues(System::String ^ name);
public virtual string[] GetValues (string name);
abstract member GetValues : string -> string[]
override this.GetValues : string -> string[]
Public Overridable Function GetValues (name As String) As String()

Parameters

name
String

The String key of the entry that contains the values to get. The key can be null.

Returns

String[]

A String array that contains the values associated with the specified key from the NameValueCollection, if found; otherwise, null.

Remarks

Caution

This method returns null in the following cases: 1) if the specified key is not found; and 2) if the specified key is found and its associated value is null. This method does not distinguish between the two cases.

This method is an O(n) operation, where n is the number of values associated with the specified key.

See also

Applies to