I am creating a helper object that has a Mailer property. In fact, the Mailer can be either System.Net.Mail.MailMessage or Mono.System.Net.Mail.MailMessage. Therefore, I would prefer only 1 ad mailer.
For example, I do not want:
private Mono.Mailing.MailMessage MonoMessage = new Mono.Mailing.MailMessage();
private System.Net.Mail.MailMessage MailMessage = new System.Net.Mail.MailMessage();
I would prefer
object mailer;
Then in the constructor
switch (software)
{
case EnunInternalMailingSoftware.dotnet:
this.mailer = new System.Net.Mail.MailMessage();
break;
case EnunInternalMailingSoftware.mono:
this.mailer = new Mono.Mailing.MailMessage();
break;
}
The problem is that mail has no properties at design time. Therefore, I cannot compile my code.
How can this be fixed, I am right. thanks in advance
source
share