Equals() public method

public Equals ( object other ) : bool
other object
return bool
示例#1
0
        public virtual void TestEquals()
        {
            CharTermAttribute t1a = new CharTermAttribute();

            char[] content1a = "hello".ToCharArray();
            t1a.CopyBuffer(content1a, 0, 5);
            CharTermAttribute t1b = new CharTermAttribute();

            char[] content1b = "hello".ToCharArray();
            t1b.CopyBuffer(content1b, 0, 5);
            CharTermAttribute t2 = new CharTermAttribute();

            char[] content2 = "hello2".ToCharArray();
            t2.CopyBuffer(content2, 0, 6);
            Assert.IsTrue(t1a.Equals(t1b));
            Assert.IsFalse(t1a.Equals(t2));
            Assert.IsFalse(t2.Equals(t1b));
        }
 public virtual void TestEquals()
 {
     CharTermAttribute t1a = new CharTermAttribute();
     char[] content1a = "hello".ToCharArray();
     t1a.CopyBuffer(content1a, 0, 5);
     CharTermAttribute t1b = new CharTermAttribute();
     char[] content1b = "hello".ToCharArray();
     t1b.CopyBuffer(content1b, 0, 5);
     CharTermAttribute t2 = new CharTermAttribute();
     char[] content2 = "hello2".ToCharArray();
     t2.CopyBuffer(content2, 0, 6);
     Assert.IsTrue(t1a.Equals(t1b));
     Assert.IsFalse(t1a.Equals(t2));
     Assert.IsFalse(t2.Equals(t1b));
 }