Hello,
I discovered some problems if I want to serialize and transfer an object
hierarchy existing of next and child pointers.
Doing this I had to implement the ISerializable interface. Lets say I have
the following class:
public class Test : ISerializable
{
[NonSerialized]
public Test child;
public Test next;
public Test()
{
}
#region ISerializable Members
protected Test(SerializationInfo info, StreamingContext context)
{
this.next = (Test)info.GetValue("next", typeof(Test));
this.child = (Test)info.GetValue("child", typeof(Test));
}
public void
GetObjectData(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
{
info.AddValue("next", this.next);
info.AddValue("child", this.child);
}
#endregion
}
If I have a list of 5000 objects where each points to its next one I get a
time for deserialization by 2,3sec while an array of the same 5000 objects
with next==null takes only 0.1sec to be transferred to the client.
Is there any special technique to handle such references??
Thanks you.
Matthias