473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Serialization of object tree

Dim


Hi!

Kinda newbie to .NET nad got following question:
Serializing objects in C#:

I have a complex object that contains lots of data and other object
including GraphicsPath, Point, Rectangle etc.. mostly
from System.Drawing, System.Windows.Forms.

When my object is constructed completelly and all graphics have been created
(btw my object inherits Panel class)
i want to be able to serialize whole bunch starting with my object and down
to the last variable in objects within that i have set.

I tried to serialize it simply by passing it to IFormatter and adding an
open file stream, but i get an exception telling
me that Panel class is not marked as Serializable. Ok i accepted this and
remade object so that only objects within should serialize. But not
enought... even GraphicsPath is apparently not serializable.
So i can't serialize nothing but simple classes with just some variables????
How can i serialize the whole tree.. cause its a big tree and saving only
primitives and reconstructing it later is way too much work.

Thanx!!!

Nov 15 '05 #1
1 5994
Dim
Ok thax man :-) I will look closer at your solution!!

"Maciej Kromrych" <ma************@poczta.onet.pl> wrote in message
news:bf**********@news.onet.pl...
I had the same problem and eventually did it the hard way ;)
I wrote a couple of wrapper classes (one for each non-
serializable type), where I could record all revelant properties.
I serialized these wrappers instead.

I also estabished a small interface to turn oryginal types into
wrappers and back (during serialization and deserialization).
I used a IDeserializationCallback interface and Reflection
(since most of the work went in the root class of my class
hierarchy).

Unfortunately I had to limit amount of types supported, since
was unable to recreate certain types on the basis of their
properties. If you find a better solution, don't forget to let
me know ;)

HTH,
Maciej

"Dim" <z5***@hotpop.com> wrote in message
news:#O**************@TK2MSFTNGP12.phx.gbl...


Hi!

Kinda newbie to .NET nad got following question:
Serializing objects in C#:

I have a complex object that contains lots of data and other object
including GraphicsPath, Point, Rectangle etc.. mostly
from System.Drawing, System.Windows.Forms.

When my object is constructed completelly and all graphics have been

created
(btw my object inherits Panel class)
i want to be able to serialize whole bunch starting with my object and

down
to the last variable in objects within that i have set.

I tried to serialize it simply by passing it to IFormatter and adding an
open file stream, but i get an exception telling
me that Panel class is not marked as Serializable. Ok i accepted this and remade object so that only objects within should serialize. But not
enought... even GraphicsPath is apparently not serializable.
So i can't serialize nothing but simple classes with just some

variables????
How can i serialize the whole tree.. cause its a big tree and saving only primitives and reconstructing it later is way too much work.

Thanx!!!



Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dominic | last post by:
Hi everybody, In my application, I'm planning to use BinaryFormatter to serialize a potentially huge object to file (and, of course, deserialize back to memory later). My question is if there is...
8
by: Eric Eggermann | last post by:
I'm having a problem with really large file sizes when serializing the classes that describe my little document. There are some circular references which result in the same object getting written...
0
by: Philipp Sumi | last post by:
Hello newsgroup I'm using XML serialization controlled over attributes to serialize a couple of simple hierarchical objects into XML. My problem is, that I have a couple of elements within the...
0
by: Jean Bon | last post by:
hello I have an application which manages a tree of objects. each object in the tree have a lot of references on other objects in the tree. in the application, I serialize a lot this tree using...
5
by: dvestal | last post by:
I have a class that needs to be serialized to a byte buffer. I'm using a large, unwieldy, homegrown serialization method, which has to change every time the class's members change, and I think...
5
by: googlenewsgroups | last post by:
I have a custom set of objects that is correctly serializing & deserializing the object tree. However in some cases the size of the resultant serialization is larger than I would expect. Is there...
2
by: Peter Duniho | last post by:
I've been learning about mechanisms .NET offers to export data. The initial goal is to see what sorts of ways are available to save an application's state (document, internal database, whatever). ...
13
by: DBC User | last post by:
I have a binary serialized file on the client box. I would like to open it with a completly different program to see what is in it. I copied the the serialized class information from the project...
3
by: sumitmahajan81 | last post by:
I am serializing a object, using XMl serialization. And it takes a while, as its a big tree structure. How can I display a progress bar showing the serialization status? Please advise. Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.