NameValueCollection.GetValues NameValueCollection.GetValues NameValueCollection.GetValues NameValueCollection.GetValues Method

定義

取得 NameValueCollection 中指定項目的值。Gets the values of a specified entry in the NameValueCollection.

多載

GetValues(Int32) GetValues(Int32) GetValues(Int32) GetValues(Int32)

取得 NameValueCollection 的指定索引的值。Gets the values at the specified index of the NameValueCollection.

GetValues(String) GetValues(String) GetValues(String) GetValues(String)

NameValueCollection 取得與指定索引鍵關聯的值。Gets the values associated with the specified key from the NameValueCollection.

GetValues(Int32) GetValues(Int32) GetValues(Int32) GetValues(Int32)

取得 NameValueCollection 的指定索引的值。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()

參數

index
Int32 Int32 Int32 Int32

以零起始的項目索引,包含從集合取得的值。The zero-based index of the entry that contains the values to get from the collection.

傳回

String[]

String 陣列,包含 NameValueCollection 的指定索引的值 (如果找到的話),否則為 nullA String array that contains the values at the specified index of the NameValueCollection, if found; otherwise, null.

例外狀況

index 超出集合索引的有效範圍。index is outside the valid range of indexes for the collection.

備註

這個方法是 O (n)運算,其中n是指定索引處的值數目。This method is an O(n) operation, where n is the number of values at the specified index.

另請參閱

GetValues(String) GetValues(String) GetValues(String) GetValues(String)

NameValueCollection 取得與指定索引鍵關聯的值。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()

參數

name
String String String String

項目的 String 索引鍵,包含要取得的值。The String key of the entry that contains the values to get. 這個索引鍵可以是 nullThe key can be null.

傳回

String[]

String 陣列,包含與 NameValueCollection 的指定索引鍵關聯的值 (如果找到的話),否則為 nullA String array that contains the values associated with the specified key from the NameValueCollection, if found; otherwise, null.

備註

警告

null在下列情況中,這個方法會傳回:1)如果找不到指定的索引鍵,則為,如果找到指定的索引鍵,且其相關聯的值為null,則為2)。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.

這個方法是 O (n)運算,其中n是與指定索引鍵相關聯的值數目。This method is an O(n) operation, where n is the number of values associated with the specified key.

另請參閱

適用於