private static SerializableAddress CopyProperties(MailAddress source, SerializableAddress destination) { var codePage = CodePageHelper.GetCodePage(source); var mailAddress = source; destination.Address = mailAddress.Address; destination.DisplayName = mailAddress.DisplayName; destination.Host = mailAddress.Host; destination.User = mailAddress.User; destination.DisplayNameCodePage = codePage ?? DefaultDisplayNameCodePage; return(destination); }
/// <summary> /// Initializes a new instance of the <see cref="T:Snork.SerializableMail.SerializableMessage" /> class by using the /// specified /// <see cref="T:Snork.SerializableMail.SerializableAddress" /> class objects. /// </summary> /// <param name="from"> /// A <see cref="T:Snork.SerializableMail.SerializableAddress" /> that contains the address of the sender of the e-mail /// message. /// </param> /// <param name="to"> /// A <see cref="T:Snork.SerializableMail.SerializableAddress" /> that contains the address of the recipient of the /// e-mail message. /// </param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="from" /> is <see langword="null" />.-or- /// <paramref name="to" /> is <see langword="null" />. /// </exception> /// <exception cref="T:System.FormatException"> /// <paramref name="from" /> or <paramref name="to" /> is malformed. /// </exception> public SerializableMessage(SerializableAddress from, SerializableAddress to) : this() { To.Add(to); From = from; }