/** * Compares for reference equality and value equality. */ public bool equals(PduContainer rhs) { bool ivarsEqual = true; if (rhs.GetType() != this.GetType()) { return(false); } if (!(_numberOfPdus == rhs._numberOfPdus)) { ivarsEqual = false; } if (!(_pdus.Count == rhs._pdus.Count)) { ivarsEqual = false; } if (ivarsEqual) { for (int idx = 0; idx < _pdus.Count; idx++) { if (!(_pdus[idx].Equals(rhs._pdus[idx]))) { ivarsEqual = false; } } } return(ivarsEqual); }
/** * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful. */ public bool equals(PduContainer rhs) { bool ivarsEqual = true; if(rhs.GetType() != this.GetType()) return false; if( ! (_numberOfPdus == rhs._numberOfPdus)) ivarsEqual = false; for(int idx = 0; idx < _pdus.Count; idx++) { Pdu x = (Pdu)_pdus[idx]; if( ! ( _pdus[idx].Equals(rhs._pdus[idx]))) ivarsEqual = false; } return ivarsEqual; }