UriTemplateEquivalenceComparer.Equals(UriTemplate, UriTemplate) UriTemplateEquivalenceComparer.Equals(UriTemplate, UriTemplate) UriTemplateEquivalenceComparer.Equals(UriTemplate, UriTemplate) UriTemplateEquivalenceComparer.Equals(UriTemplate, UriTemplate) Method

定義

2 つの UriTemplate インスタンスの等価性を比較します。Compares two UriTemplate instances for equivalence.

public:
 virtual bool Equals(UriTemplate ^ x, UriTemplate ^ y);
public bool Equals (UriTemplate x, UriTemplate y);
override this.Equals : UriTemplate * UriTemplate -> bool
Public Function Equals (x As UriTemplate, y As UriTemplate) As Boolean

パラメーター

x
UriTemplate UriTemplate UriTemplate UriTemplate

UriTemplate のインスタンス。A UriTemplate instance.

y
UriTemplate UriTemplate UriTemplate UriTemplate

UriTemplate のインスタンス。A UriTemplate instance.

戻り値

2 つの UriTemplate が等価であるかどうかを示す値。A value that indicates whether the two UriTemplate instances are equivalent.

実装

Equals メソッドを呼び出す方法を次のコード例に示します。The following code shows how to call the Equals method.

UriTemplate temp1 = new UriTemplate("weather/{state}/{city}");
UriTemplate temp2 = new UriTemplate("weather/{country}/{village}");

// Notice they are not reference equal, in other words
// they are do not refer to the same object
if (temp1 == temp2)
    Console.WriteLine("{0} and {1} are reference equal", temp1, temp2);
else
    Console.WriteLine("{0} and {1} are NOT reference equal", temp1, temp2);

// Notice they are structrually equal
UriTemplateEquivalenceComparer comparer = new UriTemplateEquivalenceComparer();
bool result = comparer.Equals(temp1, temp2);

if (result)
    Console.WriteLine("{0} and {1} are structurally equal", temp1, temp2);
else
    Console.WriteLine("{0} and {1} are NOT structurally equal", temp1, temp2);

注釈

通常、このメソッドが直接呼び出されることはありません。This method is not normally called directly. このメソッドは、2 つの UriTemplate インスタンスを比較する別のクラスによって呼び出されます。It is called by another class that is comparing two UriTemplate instances.

適用対象