的Microsoft文檔上equals方法二進制對象
public bool Binary.Equals(Binary other)
沒有給出指示,這是否測試的參考平等作爲與一般的或對象與字符串的值相等。
任何人都可以澄清?
約翰飛碟雙向的答案啓發了我將它擴大到這一點:
using System;
using System.Data.Linq;
public class Program
{
static void Main(string[] args)
{
Binary a = new Binary(new byte[] { 1, 2, 3 });
Binary b = new Binary(new byte[] { 1, 2, 3 });
Console.WriteLine("a.Equals(b) >>> {0}", a.Equals(b));
Console.WriteLine("a {0} == b {1} >>> {2}", a, b, a == b);
b = new Binary(new byte[] { 1, 2, 3, 4 });
Console.WriteLine("a {0} == b {1} >>> {2}",a,b, a == b);
/* a < b is not supported */
}
}
其實我認爲測試它這樣的,但想通有人會只知道即興(然後等走到奇怪,我癡迷併發布)。謝謝吧。 – 2009-09-23 05:46:48