NameValueCollection.Get Method

Definition

Gets the values of a specified entry in the NameValueCollection combined into one comma-separated list.

Overloads

Get(Int32)

Gets the values at the specified index of the NameValueCollection combined into one comma-separated list.

Get(String)

Gets the values associated with the specified key from the NameValueCollection combined into one comma-separated list.

Get(Int32)

Source:
NameValueCollection.cs
Source:
NameValueCollection.cs
Source:
NameValueCollection.cs

Gets the values at the specified index of the NameValueCollection combined into one comma-separated list.

C#
public virtual string Get(int index);
C#
public virtual string? Get(int index);

Parameters

index
Int32

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

Returns

A String that contains a comma-separated list of 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

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Get(String)

Source:
NameValueCollection.cs
Source:
NameValueCollection.cs
Source:
NameValueCollection.cs

Gets the values associated with the specified key from the NameValueCollection combined into one comma-separated list.

C#
public virtual string Get(string name);
C#
public virtual string? Get(string? name);

Parameters

name
String

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

Returns

A String that contains a comma-separated list of the values associated with the specified key from the NameValueCollection, if found; otherwise, null.

Remarks

Výstraha

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0