Re: persistence/serializable
Davy J <[email protected]> Wed, 28 Mar 2007 10:47:30 +0200
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
Kludge Option: I don't advocate this approach; but just anoter idea to get you thinking Try marking the Arraylist as [XmlIgnore] then adding another public property that contains a list of strings. in the Get build the list of strings from the array list; in the set build the list of arrayobjects from disk; ONLY if the arraylist is null Dave On 3/27/07, Nassar, Anthony <[email protected]> wrote: > Does anyone know how a way to do this w/o having Component implement > IXmlSerializable? Since nearly every member of that class that you want > to serialize has an acceptable default XML serialization, it shouldn't > be too hard. The only alternative that comes to mind is to use a custom > collection, and *not* ArrayList; then implement IXmlSerializable for > that class (i.e., just write out the names of the Step objects, and just > read those back in. Then the enclosing instance of Component would have > to resolve those references, though, which takes you back to > implementing IXmlSerializable for Component). > > This is why I don't like to make classes serializable. Usually I've got > a "memento" class that the real class can instantiate, or populate > itself from. I design the memento in order to be trivially serializable. > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com > -- Dave Jones [email protected] [email protected] b1xml2 : "The one thing that is differentiates VB.NET from C# is the horrible ability to do this turn Option explicit and strict off, after which VB.NET can resemble mangled spaghetti. " =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com