views:

31

answers:

2

Please help me with this WCF error....How do I handle these builtin classes for WCF?

Type 'System.Net.Mail.MailAddress' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documentation for other supported types.

Thanks

A: 

AFAIK you will most likely need to serialize the MailAddress as a string (or strings) on the server and then reassemble the MailAddress on the client.

nonnb
Any easy way out? Would appreciate any code snippet...Thanks
Josh
+1  A: 

You could implement a surrogate that knows how to de(serialize) the MailAddress type.

HTH,
Kent

Kent Boogaart