Hi All,
I am trying to pass a list to a method. The list is defined as
Private attachments As New List(Of System.Net.Mail.Attachment)...
The method declared in RemoteSMTP is
Public Function Send(ByVal mailTo As String, ByVal mailSubject As String, ByVal mailHTML As String, ByVal mailCC As String, ByVal mailBCC As String, ByVal attachments As List(Of System.Net.Mail.Attachment)) As String
...
End Function
Private Function SendEmail() As Boolean
Dim success As Boolean = True
Dim remEmail As New RemoteObjects.RemoteSMTP
Try
remEmail .MailTo = "abc@gmail.com"
remEmail .MailCC = ""
remEmail .MailBCC = ""
remEmail .MailSubject = Me.txtSubject.Text
remEmail.Attachments = attachments
remEmail.Send()
End Try
Catch ex As Exception
MsgBox("Exception caught trying to send: " & ex.Message)
success = False
Finally
remEmail =Nothing
But i get the error at remEmail.attachments = attachments "Type 'System.Net.Mail.Attachment' in Assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable."
Where am i going wrong?Please help.