/// <summary> /// Loops through an array of strings filling a MailContact list. /// </summary> /// <param name="array">string array of referred mail message field entities</param> private void UpdateListFromArray(string[] array, enumMailBoxMapping type) { for (int x = 0; x < array.Length; x++) { string text = array[x]; if (text.Length > 0) { MailContact mailContact = GetMailContact(text, type); MailContacts.Add(mailContact); } } }
/// <summary> /// Equals override to allow checking if two given objects are equal. /// Equality here was assumed to happen when all objects fields return the same value. /// This was implemented to avoid repeating objects in the same list /// (e.g., when the same entity is present in a from and a to fields). /// </summary> /// <param name="obj">Instance to compare with current object</param> /// <returns>TRUE if objects are equal, otherwise FALSE is returned</returns> public override bool Equals(object obj) { // Checks input object validity for equality operation if (obj == null || GetType() != obj.GetType()) { return(false); } // Cast input object to a proper MailContact MailContact mailContact = (MailContact)obj; // Compares MailContact public fields if (this.Name != mailContact.Name || this._mail != mailContact.Mail) { return(false); } // If it gets here, objects are equal return(true); }