UriTemplateMatch.QueryParameters Özellik
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Sorgu dizesi parametrelerinin ve değerlerinin bir koleksiyonunu alır.
public:
property System::Collections::Specialized::NameValueCollection ^ QueryParameters { System::Collections::Specialized::NameValueCollection ^ get(); };
public System.Collections.Specialized.NameValueCollection QueryParameters { get; }
member this.QueryParameters : System.Collections.Specialized.NameValueCollection
Public ReadOnly Property QueryParameters As NameValueCollection
NameValueCollection Sorgu dizesi parametrelerini ve değerlerini içeren bir örnek.
Aşağıdaki kod özelliğine nasıl erişeceklerini QueryParameters gösterir.
UriTemplate template = new UriTemplate("weather/{state}/{city}?forecast=today");
Uri baseAddress = new Uri("http://localhost");
Uri fullUri = new Uri("http://localhost/weather/WA/Seattle?forecast=today");
Console.WriteLine("Matching {0} to {1}", template.ToString(), fullUri.ToString());
// Match a URI to a template
UriTemplateMatch results = template.Match(baseAddress, fullUri);
if (results != null)
{
Console.WriteLine("QueryParameters:");
foreach (string queryName in results.QueryParameters.Keys)
{
Console.WriteLine(" {0} : {1}", queryName, results.QueryParameters[queryName]);
}
Console.WriteLine();
}
// Code output:
// QueryParameters:
// forecast : today
Dim template As New UriTemplate("weather/ state}/ city}?forecast=today")
Dim baseAddress As New Uri("http://localhost")
Dim fullUri As New Uri("http://localhost/weather/WA/Seattle?forecast=today")
Console.WriteLine("Matching 0} to 1}", template.ToString(), fullUri.ToString())
'Match a URI to a template
Dim results As UriTemplateMatch = template.Match(baseAddress, fullUri)
If (results IsNot Nothing) Then
Console.WriteLine("QueryParameters:")
For Each queryName As String In results.QueryParameters.Keys
Console.WriteLine(" 0} : 1}", queryName, results.QueryParameters(queryName))
Next
Console.WriteLine()
End If
'Code output:
' QueryParameters:
' forecast : today
Özgün URI'deki tüm sorgu dizesi adı/değer çiftleri, eşleşen şablon dizesinde açıkça belirtilmemiş olsalar bile bu koleksiyonda görünür. Bu koleksiyondaki değerler, tüm kaçış dizilerinin gerçek karakterlere çevrilmiş olmasıdır.
Ürün | Sürümler |
---|---|
.NET Framework | 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 |