共用方式為


UriTemplate.QueryValueVariableNames 屬性

定義

取得在樣板中的查詢字串內使用之變數名稱的集合。

public:
 property System::Collections::ObjectModel::ReadOnlyCollection<System::String ^> ^ QueryValueVariableNames { System::Collections::ObjectModel::ReadOnlyCollection<System::String ^> ^ get(); };
public System.Collections.ObjectModel.ReadOnlyCollection<string> QueryValueVariableNames { get; }
member this.QueryValueVariableNames : System.Collections.ObjectModel.ReadOnlyCollection<string>
Public ReadOnly Property QueryValueVariableNames As ReadOnlyCollection(Of String)

屬性值

出現在樣板字串查詢部分中之樣板變數名稱的集合。

範例

下列範例將示範如何存取 QueryValueVariableNames 屬性。

UriTemplate template = new UriTemplate("weather/{state}/{city}?forecast={day}");
Uri prefix = new Uri("http://localhost");

Console.WriteLine("QueryValueVariableNames:");
foreach (string name in template.QueryValueVariableNames)
{
    Console.WriteLine("     {0}", name);
}
Dim template As UriTemplate = New UriTemplate("weather/{state}/{city}?forecast={day}")
Dim prefix As Uri = New Uri("http://localhost")

Console.WriteLine("QueryValueVariableNames:")
For Each name As String In template.QueryValueVariableNames
    Console.WriteLine("     {0}", name)
Next

備註

這個集合會排除出現在樣板字串之路徑區段中的變數名稱。

適用於