示例#1
0
        /// <summary>
        /// Returns true if QuestionAndAnswer instances are equal
        /// </summary>
        /// <param name="other">Instance of QuestionAndAnswer to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(QuestionAndAnswer other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     QuestionId == other.QuestionId ||
                     QuestionId != null &&
                     QuestionId.Equals(other.QuestionId)
                     ) &&
                 (
                     Answer == other.Answer ||
                     Answer != null &&
                     Answer.Equals(other.Answer)
                 ));
        }
        /// <summary>
        /// Determines whether the specified Object is equal to the current Object.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLLibraryQuestion)obj;

            //reference types
            if (!Object.Equals(ValidationField1, other.ValidationField1))
            {
                return(false);
            }
            if (!Object.Equals(ValidationField2, other.ValidationField2))
            {
                return(false);
            }
            if (!Object.Equals(ValidationField3, other.ValidationField3))
            {
                return(false);
            }
            if (!Object.Equals(RegularExpression, other.RegularExpression))
            {
                return(false);
            }
            if (!Object.Equals(QuestionText, other.QuestionText))
            {
                return(false);
            }
            if (!Object.Equals(Description, other.Description))
            {
                return(false);
            }
            if (!Object.Equals(HelpText, other.HelpText))
            {
                return(false);
            }
            if (!Object.Equals(FrontLabelText, other.FrontLabelText))
            {
                return(false);
            }
            if (!Object.Equals(AfterLabelText, other.AfterLabelText))
            {
                return(false);
            }
            if (!Object.Equals(InsideText, other.InsideText))
            {
                return(false);
            }
            if (!Object.Equals(RequiredMessage, other.RequiredMessage))
            {
                return(false);
            }
            if (!Object.Equals(ValidationMessage, other.ValidationMessage))
            {
                return(false);
            }
            if (!Object.Equals(OtherFieldLabel, other.OtherFieldLabel))
            {
                return(false);
            }
            //value types
            if (!QuestionId.Equals(other.QuestionId))
            {
                return(false);
            }
            if (!m_category.Equals(other.m_category))
            {
                return(false);
            }
            if (!QuestionType.Equals(other.QuestionType))
            {
                return(false);
            }
            if (!IsRequired.Equals(other.IsRequired))
            {
                return(false);
            }
            if (!RequiredBehavior.Equals(other.RequiredBehavior))
            {
                return(false);
            }
            if (!RequiredMinLimit.Equals(other.RequiredMinLimit))
            {
                return(false);
            }
            if (!RequiredMaxLimit.Equals(other.RequiredMaxLimit))
            {
                return(false);
            }
            if (!AttributeFlags.Equals(other.AttributeFlags))
            {
                return(false);
            }
            if (!ValidationBehavior.Equals(other.ValidationBehavior))
            {
                return(false);
            }
            if (!RandomBehavior.Equals(other.RandomBehavior))
            {
                return(false);
            }
            if (!OtherFieldType.Equals(other.OtherFieldType))
            {
                return(false);
            }
            if (!OtherFieldRows.Equals(other.OtherFieldRows))
            {
                return(false);
            }
            if (!OtherFieldChars.Equals(other.OtherFieldChars))
            {
                return(false);
            }
            if (!OptionsSequence.Equals(other.OptionsSequence))
            {
                return(false);
            }
            if (!ColumnsSequence.Equals(other.ColumnsSequence))
            {
                return(false);
            }
            if (!RangeStart.Equals(other.RangeStart))
            {
                return(false);
            }
            if (!RangeEnd.Equals(other.RangeEnd))
            {
                return(false);
            }

            return(true);
        }