array, xmlserializer and inheritance
From: Smola (spam_at_supersmola.net)
Date: 01/25/05
- Next message: Bill: "Re: Problem with SMTPMail object..."
- Previous message: Morten Wennevik: "Re: .NET Framework DateTime wish"
- Next in thread: Matt Berther: "Re: array, xmlserializer and inheritance"
- Reply: Matt Berther: "Re: array, xmlserializer and inheritance"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 25 Jan 2005 17:48:36 +0100
Hi all,
I have a situation like this:
abstract class A
{
public ArrayList List;
// This list will contain objects of derived classes - like B
}
class B : A
{
}
I need to serialize class B with XmlSerializer but in the class A i
cannot define what type will go in the List (with XmlArrayItem) because
the class is abstract and I don't know what types can be derived from
it.
How can I define this in the class B? Is this approach ok:
class B : A
{
[XmlArray, XmlArrayItem (Type = typeof(B))
new public ArrayList List;
}
Thanks.
-- That's me favorite shirt. That's me only shirt!
- Next message: Bill: "Re: Problem with SMTPMail object..."
- Previous message: Morten Wennevik: "Re: .NET Framework DateTime wish"
- Next in thread: Matt Berther: "Re: array, xmlserializer and inheritance"
- Reply: Matt Berther: "Re: array, xmlserializer and inheritance"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|