HighTechTalks DotNet Forums  

Re: custom Serialization & classes derived CollectionBase (Framework 1.1)

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss Re: custom Serialization & classes derived CollectionBase (Framework 1.1) in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Gang Peng
 
Posts: n/a

Default Re: custom Serialization & classes derived CollectionBase (Framework 1.1) - 07-01-2003 , 03:49 AM






Try implent IDeserializationCallBack.
You can search MSDN for Jeffery Richter's articles about Serialization to
understand how it works.

Hope it helps,
Gang Peng
[MS]

"Curtis" <cwensley (AT) sydneyplus_nospam_ (DOT) com> wrote

Quote:
I am having a problem with .NET Framework v1.1, where it
doesn't seem to like custom serialization with classes
derived from CollectionBase. It basically NULLS out all
contained objects when retrieving...

The following code works fine in .NET Framework 1.0, but
does not in .NET Framework 1.1 (when added to a class
derived from CollectionBase):

public ListDerivedFromCollectionBase
(SerializationInfo info, StreamingContext context)
{
ArrayList list = (ArrayList)info.GetValue("list",
typeof(ArrayList));
InnerList.Clear();
InnerList.AddRange(list);
}

public void GetObjectData
(SerializationInfo info, StreamingContext context)
{
info.AddValue("list", InnerList);
}

The reasoning for this is so that other members can be
added to the list that serialize, and so that error
handling can be added for serializing to/from a database.

Any help on this would be appreciated.

Thanks,
Curtis.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.