コード例 #1
0
        public override bool Equals(object obj)
        {
            MultiHeader peer = (MultiHeader)obj;

            if (peer == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(peer, this))
            {
                return(true);
            }
            bool ret = false;

            ret = (Type == peer.Type);
            if (!ret)
            {
                return(ret);
            }
            ret = (Done == peer.Done);
            if (!ret)
            {
                return(ret);
            }
            ret = (Err == peer.Err);
            if (!ret)
            {
                return(ret);
            }
            return(ret);
        }
コード例 #2
0
        public int CompareTo(object obj)
        {
            MultiHeader peer = (MultiHeader)obj;

            if (peer == null)
            {
                throw new InvalidOperationException("Comparing different types of records.");
            }
            int ret = 0;

            ret = (Type == peer.Type)? 0 :((Type < peer.Type)?-1:1);
            if (ret != 0)
            {
                return(ret);
            }
            ret = (Done == peer.Done)? 0 : (Done?1:-1);
            if (ret != 0)
            {
                return(ret);
            }
            ret = (Err == peer.Err)? 0 :((Err < peer.Err)?-1:1);
            if (ret != 0)
            {
                return(ret);
            }
            return(ret);
        }