本文整理汇总了C#中Identity.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Identity.Equals方法的具体用法?C# Identity.Equals怎么用?C# Identity.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identity
的用法示例。
在下文中一共展示了Identity.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEndpoint
public EndpointProxy GetEndpoint(Identity target)
{
if (target.Equals(this.Identity))
throw new LinkException(Text.E_ID_DUPLICATE);
foreach (EndpointProxy p in this._connected)
if (p.Identity != null && p.Identity.Equals(target))
return p;
return null;
}
示例2: TestEquals
public void TestEquals()
{
string stringTest = "foo bar";
uint numericTest = 3;
Identity<uint> three = new Identity<uint>(typeof(Person), 3);
Identity<uint> four = new Identity<uint>(typeof(Person), 4);
Identity<uint> threeAgain = new Identity<uint>(typeof(Person), 3);
Identity<uint> threeProduct = new Identity<uint>(typeof(Product), 3);
Assert.IsFalse(three.Equals(stringTest), "Identity does not equal a string");
Assert.IsFalse(three.Equals(numericTest), "Identity does not equal a uint");
Assert.IsFalse(three.Equals(four), "Non-matching identities not equal");
Assert.IsTrue(three.Equals(three), "Copies of the same object are equal");
Assert.IsTrue(three.Equals(threeAgain), "Identical instances are equal");
Assert.IsFalse(three.Equals(threeProduct), "Non-matching types not equal");
}