本文整理匯總了C#中Binary.Equals方法的典型用法代碼示例。如果您正苦於以下問題:C# Binary.Equals方法的具體用法?C# Binary.Equals怎麽用?C# Binary.Equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Binary
的用法示例。
在下文中一共展示了Binary.Equals方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Equals
public void Equals()
{
Binary a = new Binary(Encoding.UTF8.GetBytes("a"));
Assert.IsFalse(a.Equals((Binary)null));
Assert.IsFalse(a.Equals((object)null));
Assert.IsFalse(a.Equals(new Binary(Encoding.UTF8.GetBytes("b"))));
Assert.IsTrue(a.Equals(a));
Assert.IsTrue(a.Equals(new Binary(Encoding.UTF8.GetBytes("a"))));
}
示例2: ValueCannotBeNull
public void ValueCannotBeNull()
{
var lhs = new Binary(new Byte[] { 1, 2, 3 });
Assert.False(lhs.Equals(default(Binary)));
}
示例3: CanEqualOtherBytes
public void CanEqualOtherBytes()
{
var lhs = new Binary(new Byte[] { 1, 2, 3 });
var rhs = new Binary(new Byte[] { 1, 2, 3 });
Assert.True(lhs.Equals(rhs));
}
示例4: CanEqualBoxedRawBytes
public void CanEqualBoxedRawBytes()
{
var lhs = new Binary(new Byte[] { 1, 2, 3 });
var rhs = new Byte[] { 1, 2, 3 };
Assert.True(lhs.Equals((Object)rhs));
}
示例5: CanUseReferenceEquality
public void CanUseReferenceEquality()
{
var lhs = new Binary(new Byte[] { 1, 2, 3 });
Assert.True(lhs.Equals(lhs));
}
示例6: AllBytesMustBeEqual
public void AllBytesMustBeEqual()
{
var lhs = new Binary(new Byte[] { 1, 2, 3, 4 });
var rhs = new Binary(new Byte[] { 1, 2, 2, 4 });
Assert.False(lhs.Equals(rhs));
}