Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serializing an object

Status
Not open for further replies.

matthewking

Programmer
Jul 15, 2002
75
ES
Hi all,

I have a serializable class 'A', which holds an arraylist.
I add an instance of serializable class 'B' to this arraylist, then attempt to serialize class A using binary formatter, but at that point it dies. I've run it through the debugger and it just stops at the serialization statement, and doesn't complete the statement after.

Both serialization classes are under the same namespace, in the same assembly.

Any ideas on why its not working or what I have to do to make it work?

Thanks,

Matt.
 
It sure sounds like a cycle exists somewhere, which would only be possible if you are doing manual serialization. When you say the classes A & B are serializable, do you mean that they have marked them with the [Serializable] attribute, or did you do more than that (using ISerializable etc.)
 
The .NET serialization doesn't recurse through the member variables (like when it's an arraylist). You'll have to manually serialize this class.

Chip H.

If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top