Can this be done? My problem is that I have this Serializable class:
[Serializable()]
public class Car
{
[System.Xml.Serialization.XmlElement("Make")]
public string m_make;
[System.Xml.Serialization.XmlElement("Owner")]
public string m_owner;
[System.Xml.Serialization.XmlElement("Plate")]
public string m_plate;
[System.Xml.Serialization.XmlElement("Type")]
public TenantType m_type = TenantType.Test;
public Car()
{
}
}
I want to add a non-serializable object (one that does not extend ISerializable) to this class, but I keep getting a runtime error: "There was an error reflecting type 'Program.Car'." I put the NonSerialized() tag before it, but I think C# still doesn't get that I won't want it to be serialized at any point.
[NonSerialized()]
public MyObject m_obj;