473,394 Members | 1,735 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,394 software developers and data experts.

More Serialization Questions--Specific example of what I need to do

My other thread on serialization seemed to be stagnant and I still have
questions, so I decided to post this example of what I need to know.

I am trying to use binaryformatter. I have no trouble saving (serializing),
but when I go to deserialize I always get errors. It appears that I cannot
set a breakpoint or anything to discover where the problem is.

I am serializing by implementing ISerializable: The GetObjectData method
and the custom Constructor.

The last problem I got was an exception--TargetInvocationException class to
be exact.

My object model has things like the following to deal with:

MDIForm (which has a bunch of frmA's) frmA which has a Workspace object.
This object has some members of intrinsic data types and then some other
members that are other objects.

For the sake of this newsgroup let me give an example scenario:

Workspace has a reference to the form that "owns" it (this is not
serializable of course).

So imagine
class Workspace
private A as single
private B as single
private ParentForm as frmA
private objSomething as Something
end class

class Something
'class something has a reference to the parent Workspace object to which
it belongs
private ParentWorkSpace as workspace
end class

my thought was, in GetDataObject for workspace object to just do the
following:
info.addvalue("A",A)
info.addvalue("B",B)
info.addvalue("objSomething",Something)

and then in the specialized contstructor for deserializing
A=info.getsingle("A")
B=info.getsingle("B")

objSomething=ctype(info.getvalue("objSomething",ge ttype(something)),something)
'then at this point, maybe call a method on objSomething to set the
parent workspace object
'reference to this object
objSomething.SetParentWorkspace=me

I would do the same thing to the Workspace object itself after being
deserialized, it would set the ParentForm with a method.

I have read the aricle from around 2001-2 by Jeffery Richter and think I may
not be able to rely on reseting references in the constructor and perhaps I
should implement IDeserializationCallBack and somehow in there set the
reference.

Since I have collection of objects and those objects need to have a
reference to the parent form--where they will be painting, would I be able
to deserialize this and how?

Am I on the wrong track?

Any more ideas and suggestions would be appreciated.

I found another article but it was on .NET 2.0. Is that out yet? Or is that
just part of Whidbey that hasn't really yet materialized?

Thanks,

Shane
Nov 21 '05 #1
0 1053

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

Similar topics

58
by: Jeff_Relf | last post by:
Hi Tom, You showed: << private const string PHONE_LIST = "495.1000__424.1111___(206)564-5555_1.800.325.3333"; static void Main( string args ) { foreach (string phoneNumber in Regex.Split...
4
by: Jeff T. | last post by:
Hello, I have an existing set of C# classes that encapsulate our application data. They are in a heirachy with each subclass defining more specific types of data. I would like to serialize these...
8
by: vinay | last post by:
Hi Guys I want to understand Serialization. What is serialization. When do we need to use?? What are advantages and Disadvantages. Also please diret me to some good sites on serialization....
0
by: Frank Rizzo | last post by:
Hello, I have a click-once/SmartClient app and the "Generate serialization assembly" option under Project Properties/Build is set to Auto. When I run msbuild from the command line, sgen.exe...
4
by: Flamingo | last post by:
Hi folks, I want a webpage, there would be a input textfield, and a "sumbit" button there, if you press the submit button, the contents you input to the textfield would be send to your...
4
by: vunet.us | last post by:
I would like to create web charts. My site is using AJAX, so I thought of VML and SVG for chart graphics. But there is a browser compatibility issue. Flash would be a good solution but I do not...
2
by: buddyr | last post by:
example: field1 bblandscape, wallmart, kmart field2 4,6,9 field3 5,7,6 field4 12,0,5 field5 if field2 > field3 then field5 = "Yes" if field4 = 0 then field5 = "Yes"
1
by: precision | last post by:
hello, i have an example in P y t h o n and would like if anyone of you can help me to get its solution. you can add me at yahoo: xxxx@xxx.xxx so that we can talk about it.
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.