Is it possible to use the BinaryFormatter Serialize/Deserialize methods to serialize and deserialize a class that contains UI objects? I know it's likely not recommended and only data should really be serialized, but is there a reason why it would not be supported technically?
Say, for example, I had a class such as:
public class MyClass
{
private List<UC1> _ucList1 = new List<UC1>();
private List<UC2> _ucList2 = new List<UC2>();
public MyClass() {}
}
In the above theoretical class, UC1 and UC2 are of type UserControl - so a list of user controls. Is there a reason why that could not be deserialized? I did some testing and it appears to serialize into a byte array fine, but the deserialization routine throws an exception "End of Stream encountered before parsing was completed."