UriTemplate.PathSegmentVariableNames 屬性

定義

取得在樣板中的路徑區段內使用之變數名稱的集合。

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

屬性值

出現在樣板內路徑區段中之變數名稱的集合。

範例

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

UriTemplate template = new UriTemplate("weather/{state}/{city}?forecast={day}");

Uri prefix = new Uri("http://localhost");

Console.WriteLine("PathSegmentVariableNames:");
foreach (string name in template.PathSegmentVariableNames)
{
    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("PathSegmentVariableNames:")
For Each name As String In template.PathSegmentVariableNames
    Console.WriteLine("     {0}", name)
Next

備註

此集合會排除出現在樣板查詢部分中之變數的名稱。

適用於