Re: XML Serialize question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 08/02/04


Date: Mon, 2 Aug 2004 09:44:31 -0400

Dom,

    The XML serializer can not handle abstract or interface references
because when deserializing the object, it will not know which type to create
and then populate with values.

    If you want to serialize your objects in XML format and be able to
handle this, then you will have to use the SoapFormatter to serialize the
class.

    Hope this helps.

-- 
               - Nicholas Paldino [.NET/C# MVP]
               - mvp@spam.guard.caspershouse.com
"Dominic" <dominicsmith501@hotmail.com> wrote in message
news:514ecc2b.0408011530.52cdfc10@posting.google.com...
> I am using XmlSerializer to serialize my object. The object has
> various public members which are object references. This all works
> fine.
>
> However, one member (mShape) is declared as a reference to an abstract
> base class, IShape. The member actually references a concrete subclass
> such as Square or Circle.
>
> Th serializer doesn't seem to be able to hand this. Any ideas on what
> to do?
>
> Dom


Relevant Pages

  • XML Serialize question
    ... I am using XmlSerializer to serialize my object. ... various public members which are object references. ... one member (mShape) is declared as a reference to an abstract ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: version compatibility when serializing and deserializing
    ... to deserialize an object that lacks that member, ... file with the serialized object and I didn't get any exception. ... You would need to serialize an ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: 2006 Kinscherff High Noon cutaway Madagascar/Adi
    ... I was told by a member of this ... the 7k range with the Madagascar upcharge (assuming it's at least ... MANY references if you are uncomfortable with sending out a Cashier's ... My Ebay user ID is 6strings-14clubs and my ...
    (rec.music.makers.guitar.acoustic)
  • Re: circular relationships ok?
    ... are circular relationships something that ... So, what if A references B, B references C and C references A? ... If an element e1 references element e2 then it is interpreted as e1 is a member of e2, where e2 is a collection. ... Naturally we do not want to have a cycle somewhere in our structure of levels because that would mean that one level is a more specific or more general level of itself. ...
    (comp.databases.theory)
  • Re: 2006 Kinscherff High Noon cutaway Madagascar/Adi
    ... I was told by a member of this ... newsgroup that there were some Kinscherff enthusiasts that "lurk" ... MANY references if you are uncomfortable with sending out a Cashier's ... My Ebay user ID is 6strings-14clubs and my ...
    (rec.music.makers.guitar.acoustic)