huckfinn19
Programmer
Hi!
I am trying to serialize a class that contains a list of objects. Here's the situation:
So I need a way to serialize and unserialize the list of objects B contained in A. Normally, B would be a more complicated class with the serialization capabilities too.
Thanks!
Huck
I am trying to serialize a class that contains a list of objects. Here's the situation:
Code:
[Serializable()]
class A: ISerializable{
ArrayList m_aList;//Contains objects of type B
//... methods to fill array with object B
public A(){}
public A(SerializationInfo info, StreamingContext ctxt)
{
//***Need to serialize the list of objects B here!!
}
public void GetObjectData(SerializationInfo info,
StreamingContext ctxt)
{
//***How can I unserialize the list here?
}
}
class B{
string m_sName;
public string Name{
get{return m_sName;}
set{m_sName = value;}
}
public B(){}
}
So I need a way to serialize and unserialize the list of objects B contained in A. Normally, B would be a more complicated class with the serialization capabilities too.
Thanks!
Huck