コード例 #1
0
        /**
         * Compares for reference equality and value equality.
         */
        public bool equals(SetRecordReliablePdu rhs)
        {
            bool ivarsEqual = true;

            if (rhs.GetType() != this.GetType())
            {
                return(false);
            }

            ivarsEqual = base.Equals(rhs);

            if (!(_requestID == rhs._requestID))
            {
                ivarsEqual = false;
            }
            if (!(_requiredReliabilityService == rhs._requiredReliabilityService))
            {
                ivarsEqual = false;
            }
            if (!(_pad1 == rhs._pad1))
            {
                ivarsEqual = false;
            }
            if (!(_pad2 == rhs._pad2))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfRecordSets == rhs._numberOfRecordSets))
            {
                ivarsEqual = false;
            }

            if (!(_recordSets.Count == rhs._recordSets.Count))
            {
                ivarsEqual = false;
            }
            if (ivarsEqual)
            {
                for (int idx = 0; idx < _recordSets.Count; idx++)
                {
                    if (!(_recordSets[idx].Equals(rhs._recordSets[idx])))
                    {
                        ivarsEqual = false;
                    }
                }
            }


            return(ivarsEqual);
        }
コード例 #2
0
        /**
          * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
          */
        public bool equals(SetRecordReliablePdu rhs)
        {
            bool ivarsEqual = true;

            if(rhs.GetType() != this.GetType())
            return false;

             if( ! (_requestID == rhs._requestID)) ivarsEqual = false;
             if( ! (_requiredReliabilityService == rhs._requiredReliabilityService)) ivarsEqual = false;
             if( ! (_pad1 == rhs._pad1)) ivarsEqual = false;
             if( ! (_pad2 == rhs._pad2)) ivarsEqual = false;
             if( ! (_numberOfRecordSets == rhs._numberOfRecordSets)) ivarsEqual = false;

             for(int idx = 0; idx < _recordSets.Count; idx++)
             {
            RecordSet x = (RecordSet)_recordSets[idx];
            if( ! ( _recordSets[idx].Equals(rhs._recordSets[idx]))) ivarsEqual = false;
             }

            return ivarsEqual;
        }