This is the class I'm trying to serialize
[Serializable]
public class PendingAccountInfo
{
public AccountId AccountId { get; set; }
public string EmailAddress { get; set; }
}
[Serializable]
public struct AccountId : IEquatable<AccountId>
{
private readonly int _id;
public AccountId(int id) {
_id = id;
}
public int Id {
get { return _id; }
}
...
}
This is how I do the serialization
XmlSerializer xmlserializer = new XmlSerializer(typeof(List<T>));
StringWriter stringWriter = new StringWriter();
XmlWriterSettings settings = new XmlWriterSettings { OmitXmlDeclaration = true, Indent = true };
XmlWriter writer = XmlWriter.Create(stringWriter, settings);
xmlserializer.Serialize(writer, value);
string result = stringWriter.ToString();
This is what I get
<PendingAccountInfo>
<AccountId />
<EmailAddress>test@test.com</EmailAddress>
</PendingAccountInfo>
From what I read, this should work, but I must be missing something