I have the constructor as for ISerializable as well but still no luck.
Here's some more information:
I have the [Serializable] attribute directly before the class definition and
the class implements ISerializable.
The purpose of this is to return the TopContainer class from a WebMethod.
When I look at the web reference that is created, I see the class names but
TopContainer doesn't contain a LevelTwoType.
TopContainer encapsulates LevelTwoType which encapsulates an arraylist,
which is an Array of LevelThreeType. LevelThreeType encapsulates another
ArrayList which is an Array of LevelFourType. LevelFourType encapsulates a
class which encapsulates an ArrayList (this class does serialize because I
use it in other places and it works fine )
All classes have the [Serializable] attribute.
I hope this isn't too confusing.
Thanks again.
"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:#y**************@TK2MSFTNGP14.phx.gbl...
ISerialisable is definately the way forward if you want to serialise to
binary stream.
From what i remember you need a serialisation contructor (which
instantiates the object from the serialised data).
A GetObjectData method which is used to add (member) data to a
serialisation object
There's another method you need to implement too and serialiable class
attribute needs adding also. I can't check at moment as installing SP,
but look in google for an example of implementing ISerialisable, you wont be
far wrong.
If you get stuck, reply and I'll try to give you more info later (when my
machine's sorted)
HTH
Sam
"Joe" <J_no_spam@_no_spam_Fishinbrain.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...I have several classes which I need serialized. Here is their class
definitions:
public class TopContainer
{
private LevelTwoType m_levelTwo;
public LevelTwoType LevelTwo
{
get
{
return m_levelTwo;
}
}
...
}
public class LevelTwoType
{
private ArrayList m_levelThree;
public LevelThreeType LevelThree this [int index]
{
get
{
return (LevelThreeType)m_levelThree[index];
}
}
// Plus the following
Add(LevelThreeType)
Count
...
}
there are 2 more classes similar to LevelTwoType class.
I can't get these to serialize. I tried using the ISerializable
interface and implement the GetObjectData method but still no luck.
If I use the ICollection interface it sort of works but not the way I
need it to.