// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System.Collections;
using System.Runtime.Serialization;
namespace System.Net.Mail {
- public class SmtpFailedRecipientsException : SmtpException
+ [Serializable]
+ public class SmtpFailedRecipientsException : SmtpFailedRecipientException, ISerializable
{
#region Fields
- ArrayList exceptions = new ArrayList ();
- ArrayList failedRecipients = new ArrayList ();
+ SmtpFailedRecipientException[] innerExceptions;
#endregion // Fields
- #region Properties
+ #region Constructors
+
+ public SmtpFailedRecipientsException ()
+ {
+ }
+
+ public SmtpFailedRecipientsException (string message) : base (message)
+ {
+ }
+
+ public SmtpFailedRecipientsException (string message, Exception innerException) : base (message, innerException)
+ {
+ }
- public SmtpException[] Exceptions {
- get { return (SmtpException[]) exceptions.ToArray (typeof (SmtpException)); }
+ public SmtpFailedRecipientsException (string message, SmtpFailedRecipientException[] innerExceptions) : base (message)
+ {
+ this.innerExceptions = innerExceptions;
+ }
+
+ protected SmtpFailedRecipientsException (SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info");
+ innerExceptions = (SmtpFailedRecipientException []) info.GetValue ("innerExceptions", typeof (SmtpFailedRecipientException []));
}
+
+ #endregion
- public string[] FailedRecipients {
- get { return (string[]) exceptions.ToArray (typeof (string)); }
+ #region Properties
+
+ public SmtpFailedRecipientException[] InnerExceptions {
+ get { return innerExceptions; }
}
#endregion // Properties
#region Methods
- internal void AddFailedRecipient (SmtpException e, string recipient)
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info");
+ base.GetObjectData (info, context);
+ info.AddValue ("innerExceptions", innerExceptions);
+ }
+
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
{
- exceptions.Add (e);
- failedRecipients.Add (recipient);
+ GetObjectData (info, context);
}
#endregion // Methods
}
}
-#endif // NET_2_0