NameValueCollection.GetValues 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 NameValueCollection 中指定項目的值。
GetValues(Int32) |
取得 NameValueCollection 之指定索引處的值。 |
GetValues(String) |
取得與 NameValueCollection 中指定索引鍵相關聯的值。 |
取得 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 陣列,包含 NameValueCollection 之指定索引處的值 (如果找到的話),否則為 null
。
例外狀況
index
超出集合索引的有效範圍。
備註
這個方法是 O (n
) 作業,其中 n
是指定索引的值數目。
另請參閱
適用於
.NET 9 及其他版本
產品 | 版本 |
---|---|
.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 |
.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 |
取得與 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()
參數
傳回
String 陣列,包含與 NameValueCollection 中指定索引鍵相關聯的值 (如果找到的話),否則為 null
。
備註
警告
這個方法會在下列情況下傳回:如果找不到指定的索引鍵,則傳回 1) ;如果找到指定的索引鍵,且其相關聯的值為 null
,則傳回 null
2) 。 這個方法不會區分這兩種情況。
這個方法是 O (n
) 作業,其中 n
是與指定索引鍵相關聯的值數目。
另請參閱
適用於
.NET 9 及其他版本
產品 | 版本 |
---|---|
.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 |
.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 |