[Mono-devel-list] Serializing widgets with C#
albertoavila at gmail.com
Mon Aug 1 16:17:48 EDT 2005
You could use [Serializable] in your class and implements ISerialiable.
So, you are not going to serialize all the widgets, instead you are
going to serialize the info needed to build it again (implementing
GetObjectData and a constructor defined in ISerializable).
in GetObjectData you are going to tell to the serialization engine
what info do you need to save, for example the text for labels, or
In the constructor you'll read the data that the serialization engine
gives you, and it'll be your responsability to bouild all the widgets
I hope that this could be useful.
On 8/1/05, Andreas Nahr <ClassDevelopment at a-softtech.com> wrote:
> I don't know what exactly you are trying to do, but it seems you want to use
> it as a kind of "saving something".
> The problem with (binary) serialization is that nobody guarantees that
> different .net versions will serialize the same way.
> So a serialized file saved in .net 1.0 may not open in 1.1 may not open in
> Also a file from MS.Net may not open in Mono may not open in Dotgnu.
> If that doesn't matter it should work (like only saving a cache that could
> be simply deleted if it cannot be restored), otherwise other mechanisms are
> more appropriate...
> > What you're trying to accomplish is impossible. first because gtk
> > widgets are not serializable and secondly, it just sounds like a bad
> > idea all together :-). In order for you to serialize an array of
> > anything the entire object graph needs to be serializable, so if you
> > wrap a gtk widget in a class that is ISerializable, it will still fail
> > since the widget isn't.
> Yeap, I can assure you that nor by marking it or implementing
> ISerializable it works that was why ask you all :o). However, the answer
> impossible it also and end of this pursuit. Thanks for that knowledge.
> By the way, why do you think it is a bad idea (if it could have been
> done) this solution?
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
More information about the Mono-devel-list