UriTemplateMatch.BaseUri Özellik

Tanım

Şablon eşleşmesi için temel URI'yi alır veya ayarlar.

C#
public Uri BaseUri { get; set; }

Özellik Değeri

Uri

Uri Şablon eşleşmesi için temel URI'yi temsil eden bir örnek.

Örnekler

Aşağıdaki kod özelliğine nasıl erişeceklerini BaseUri gösterir.

C#
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)
{
    // BaseUri
    Console.WriteLine("BaseUri: {0}", results.BaseUri);
}
// output:
// BaseUri: http://localhost

Şunlara uygulanı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