Adding Attributes at Runtime

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

I would like to add the Serializable attribute to an object at
runtime. I want to send a System.Web.Mail.MailMessage over the line
using Remoting, but MailMessage is not serializable.

Thanks in advance,
Rob
 
Rob,

The MailMessage class is not sealed, so you could create your own class
that derives from it, tagging it with the Serializable attribute.

You can not add attributes to a type at runtime.

Hope this helps.
 
Back
Top