public SerializableAttachment(Attachment attachment) { ContentId = attachment.ContentId; ContentDisposition = new SerializableContentDisposition(attachment.ContentDisposition); ContentType = new SerializableContentType(attachment.ContentType); Name = attachment.Name; TransferEncoding = attachment.TransferEncoding; NameEncoding = attachment.NameEncoding; if (attachment.ContentStream != null) { byte[] bytes = new byte[attachment.ContentStream.Length]; attachment.ContentStream.Read(bytes, 0, bytes.Length); ContentStream = new MemoryStream(bytes); } }