NameValueCollection.GetValues 方法

定义

获取指定 NameValueCollection项的值。

重载

名称 说明
GetValues(Int32)

获取指定索引 NameValueCollection处的值。

GetValues(String)

从中 NameValueCollection获取与指定键关联的值。

GetValues(Int32)

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

获取指定索引 NameValueCollection处的值。

public:
 virtual cli::array <System::String ^> ^ GetValues(int index);
public virtual 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()

参数

index
Int32

包含要从集合中获取的值的项的从零开始的索引。

返回

String[]

一个 String 数组,包含指定索引处的值 NameValueCollection(如果找到);否则为 null

例外

index 超出集合的有效索引范围。

注解

此方法是 O(n) 操作,其中 n 指定索引处的值数。

另请参阅

适用于

GetValues(String)

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

从中 NameValueCollection获取与指定键关联的值。

public:
 virtual cli::array <System::String ^> ^ GetValues(System::String ^ name);
public virtual string[] GetValues(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()

参数

name
String

String包含要获取的值的条目的键。 键可以是 null

返回

String[]

一个 String 数组,其中包含与指定键 NameValueCollection关联的值(如果找到);否则为 null

注解

Caution

如果找不到指定的键,此方法将返回 null 以下情况:1)如果找到指定的键并且其关联的值为 null,则为 2)。 此方法不区分这两种情况。

此方法是 O(n) 操作,其中 n 与指定键关联的值数。

另请参阅

适用于