I have this code for serializing my custom collection of UserData Objects. However the current
property only represents the item currently being used in the collection, so it only serializes that one object.
I want all the objects serialized in my collection, how would I go about that in the GetObjectData
implementation of my Collection?
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
// Add the userdata object to SerializationInfo object
info.AddValue("UserData", current);
}
this is my deserialization constructor, I'm not sure this will then deserialize each object in the collection either.
public UserDataCollection(SerializationInfo serializationInfo, StreamingContext ctxt)
{
UserData data = (UserData)serializationInfo.GetValue("UserData", typeof(UserData));
// Add to objects existing collection
this.Add(data);
}