UriTemplate.IsEquivalentTo(UriTemplate) 方法

定義

指出 UriTemplate 在結構上是否與另一個樣板相等。

public:
 bool IsEquivalentTo(UriTemplate ^ other);
public bool IsEquivalentTo (UriTemplate other);
member this.IsEquivalentTo : UriTemplate -> bool
Public Function IsEquivalentTo (other As UriTemplate) As Boolean

參數

other
UriTemplate

要比較的 UriTemplate

傳回

Boolean

如果 UriTemplate 在結構上等於另一個樣板,則為 true;否則為 false

範例

下列範例將示範如何呼叫 IsEquivalentTo(UriTemplate)

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

bool equiv = template.IsEquivalentTo(template2);
Dim template As UriTemplate = New UriTemplate("weather/{state}/{city}?forecast={day}")
Dim template2 As UriTemplate = New UriTemplate("weather/{country}/{village}?forecast={type}")

Dim equiv As Boolean = template.IsEquivalentTo(template2)

備註

如果這兩個 UriTemplate 執行個體的常值字串完全相同,而且這些變數出現在相同的區段中,它們就是相等的。 例如,"weather/{state}/{city}" 相等於 "weather/{country}/{village}"。

適用於