I've never used structs before. I've created a simple example of what I'm trying to do below. The reason I've chosen struts is because the object will never need to exist outside the context of the class. Thanks.
Classes
public class EmailAddress
{
public string Email { get; set; }
public string Name { get; set; }
}
public class EmailMessage
{
public EmailAddress To { get; set; }
public EmailAddress From { get; set; }
public string Subject { get; set; }
public string Body { get; set; }
public struct Attachment
{
public string Name { get; set; }
public string Bas64 { get; set; }
}
Attempted Method
protected void MyMethod()
{
var myEmailMessage = new EmailMessage
{
To = { Email = "ToEmailAddress" },
From = { Email = "FromEmailAddress" }
};
var myAttachment = new EmailMessage.Attachment
{
Name = "AttachmentName",
Bas64 = "Base64String"
};
myEmailMessage.Attachment = myAttachment;
}
Attachmentstructhere.