NameValueCollection.GetValues 方法

定義

取得 NameValueCollection 中指定項目的值。

多載

GetValues(Int32)

取得 NameValueCollection 之指定索引處的值。

GetValues(String)

取得與 NameValueCollection 中指定索引鍵相關聯的值。

GetValues(Int32)

取得 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)

取得與 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

備註

警告

這個方法會在下列情況下傳回:如果找不到指定的索引鍵,則傳回 1) ;如果找到指定的索引鍵,且其相關聯的值為 null ,則傳回 null 2) 。 這個方法不會區分這兩種情況。

這個方法是 O (n) 作業,其中 n 是與指定索引鍵相關聯的值數目。

另請參閱

適用於