473,803 Members | 4,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

serializing

Hello NG,

Im Trying to save some App Data by De-/ Serializing an Object:

Public Function DeSerializeFrom Byte(ByVal Bytes As Byte()) as
SerializableCla ss
Dim myObject As SerializableCla ss
Dim mySerializer As
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er = New
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er()
Dim myMemoryStream As System.IO.Memor yStream = New
System.IO.Memor yStream(Bytes)
myObject = CType(mySeriali zer.Deserialize (myMemoryStream ),
SerializableCla ss)
myMemoryStream. Close()
Return myObject
End Function

My Problem is, that I have 2 Applications with different Assembly Names. If
I Serialize the Object in App1 then I get an Exception in App2, if I try to
DeSerialize it.

Does anybodey Know how I can DeSerialize a Binary (by not using XML) File to
another Application?

Thanks

Niels Wiederanders
Mar 6 '07 #1
1 1006
Niels,

The most simple one I know

http://www.vb-tips.com/dbpages.aspx?...c-61641f5c8d9d

Be aware this works only for serializable classes. The arraylist is that
already. To make your class serializable just add the tag.

Cor

"Niels Wiederanders" <pa*****@gmx.de schreef in bericht
news:es******** *****@news.t-online.com...
Hello NG,

Im Trying to save some App Data by De-/ Serializing an Object:

Public Function DeSerializeFrom Byte(ByVal Bytes As Byte()) as
SerializableCla ss
Dim myObject As SerializableCla ss
Dim mySerializer As
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er = New
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er()
Dim myMemoryStream As System.IO.Memor yStream = New
System.IO.Memor yStream(Bytes)
myObject = CType(mySeriali zer.Deserialize (myMemoryStream ),
SerializableCla ss)
myMemoryStream. Close()
Return myObject
End Function

My Problem is, that I have 2 Applications with different Assembly Names.
If I Serialize the Object in App1 then I get an Exception in App2, if I
try to DeSerialize it.

Does anybodey Know how I can DeSerialize a Binary (by not using XML) File
to another Application?

Thanks

Niels Wiederanders

Mar 7 '07 #2

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

Similar topics

1
3278
by: Ryan Hubbard | last post by:
I've have been trying to serialize an array of objects. I can serialize and set a session variable and retrieve it successfully for a serialize string of any length within the contents of a single script. $_SESSION = serialize($b); // strlen($a) = 120,011 print unserialize($_SESSION) But if I set a session variable and then try to access it on another
2
3303
by: Aleksei Guzev | last post by:
Imagine one writing a class library CL1 for data storage. He defines classes ‘DataItem’ and ‘DataRecord’ so that the latter contains a collection of the former. And he derives class ‘IntItem’ from ‘DataItem’ public class DataItem { public DataItem() {}
1
2089
by: Ivo Bronsveld | last post by:
All, I have quite a challenging task ahead of me. I need to write an object model (for code access) based on a schema, which cannot be made into a dataset because of it's complexity. So I created a couple of objects and serializing it into XML based upon the schema works perfectly. The XML / Schema looks something like this:
10
8318
by: copx | last post by:
I want to save a struct to disk.... as plain text. At the moment I do it with a function that just writes the data using fprintf. I mean like this: fprintf(fp, "%d %d", my_struct.a, my_struct.b) This way I have to write another "serializing" function for every new kind of struct I want to write, though. Is there a way to write functions that can write/read any struct to/from plain text format in a portable way?
1
5405
by: Chris | last post by:
I'm having trouble Serializing a System.Data.DataColumn object. When I try to serialize it, I get the following: System.NotSupportedException: Cannot serialize member System.ComponentModel.MarshalByValueComponent.Site of type System.ComponentModel.ISite because it is an interface. I tried a number of workarounds without sucess:
2
3524
by: Tobias Zimmergren | last post by:
Hi, just wondering what serializing really is, and howto use it? Thanks. Tobias __________________________________________________________________ Tobias ICQ#: 55986339 Current ICQ status: + More ways to contact me __________________________________________________________________
4
1680
by: Jason Shohet | last post by:
We are thinking of serializing an object & passing it toseveral functions on web service. This will happen about 35 times as the page loads. The class has about 20 attributes. We're not sure on the impact serializing something has on an asp.net page rendering, compared to say, hitting the db or something like that. THanks Jason Shohet
2
1342
by: Simon | last post by:
I'm developing a new application and want to use serialization as a way to save my data. But as I add new variables to my classes, how will serializing cope with that? For example, suppose I have a class called Point which has 2 variables X and Y. I save a few jobs (by serializing), and then enhance my application by adding a Z variable. How will serializing behave when loading those jobs that were created before Z was added?
7
2828
by: fjlaga | last post by:
I have written an Office Add-in for Excel using VB.NET and the .NET 1.1 Framework (I have Visual Studio 2003 .NET ). All works great. I want to add a User Settings/Prefereneces dialog and allow the user to specify some settings and I need to persist these settings between runs. I made a serializable class which uses the BinaryFormatter to serialize/deserialize the setttings. Serialization works great. However, when I try to...
12
4925
by: Cagdas Ozgenc | last post by:
Greetings, When directly serializing C++ structures to a file with the standard library functions giving the address of the data and length of structure using the sizeof operator, do I risk portability because of different compilers packing structures into different sizes or components of this structure to different address boundaries (for example placing in multiples of 4 on a 32bit system)? Once the file is serialized, does the same...
0
9564
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10316
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9125
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.