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

Serialization Stuff...

Well I wrote this code that saved a Serialized ArrayList to disk in
VB.NET and tried to read it in with another one in C#. Got some funny
exception about my Assembly (can't rember exactly), what's with the
assembly stuff.

Jun 21 '06 #1
5 1313
Unfortunately, without theat assembly stuff, it will be difficult to
determine what the problem is.

Can't you reproduce it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Obinna" <ob**************@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Well I wrote this code that saved a Serialized ArrayList to disk in
VB.NET and tried to read it in with another one in C#. Got some funny
exception about my Assembly (can't rember exactly), what's with the
assembly stuff.

Jun 21 '06 #2
Obinna wrote:
Well I wrote this code that saved a Serialized ArrayList to disk in
VB.NET and tried to read it in with another one in C#. Got some funny
exception about my Assembly (can't rember exactly), what's with the
assembly stuff.


Hard to tell without seeing the exception and the code that generates it.

Are you sure that all the types of the objects that have been added to
the ArrayList are known to both the VB.NET and C# assemblies? If you
serialize a type thats not known on the other side, you'll get an exception.

Max
Jun 21 '06 #3
Obinna wrote:
Well I wrote this code that saved a Serialized ArrayList to disk in
VB.NET and tried to read it in with another one in C#. Got some funny
exception about my Assembly (can't rember exactly), what's with the
assembly stuff.


Hi Obinna,

What does your arraylist contain?

-- Tom Spink
Jun 22 '06 #4
Can I have your cs file? If the code is short can just paste it here.

chanmm

"Obinna" <ob**************@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Well I wrote this code that saved a Serialized ArrayList to disk in
VB.NET and tried to read it in with another one in C#. Got some funny
exception about my Assembly (can't rember exactly), what's with the
assembly stuff.

Jun 22 '06 #5
'
--------------------------------------------------------------------------
And here it is:

' VB.NET code to save the ArrayList object to file
' it could have been in any other dot NET language.
'
--------------------------------------------------------------------------
Private xlist As New ArrayList()

<Serializable()> Structure Human
Dim firstname As String
Dim lastname As String
End Structure

For i = 0 to <any Number>
Dim p As Human
p.firstname = "Obinna"
p.lastname = "Chikwendu"
xlist.Add(p)
Next

Dim fName As String = "C:\test.bin"
Dim fs As FileStream
Dim bf As New BinaryFormatter()

fs = File.Create(fName)
fs.Seek(0, SeekOrigin.End)
bf.Serialize(fs, xlist)
fs.Close()

/************************************************** **************
C# code to retrieve the value stored in the file
Note: it works if both are compiled in the same assembly
but I intend to load the ArrayList from a different assembly
************************************************** **************/
String fName = "C:\test.bin";
FileStream fs;
BinaryFormatter bf = new BinaryFormatter();

try{
fs = File.OpenRead(fName);
xlist = CType(bf.Deserialize(fs), ArrayList);
// retrieving the data from file ...
Human p;
for (i = 0; i < xlist.Count - 1; i++){
p = xlist.Item(i);
str = p.firstname & " " & p.lastname;
}
}
catch (Exception exp){
MessageBox.Show(exp.Message);
}
finally{
fs.Close();
}
/*******************************
When run the message box displays:
"File or assembly name <Project name>, or one of its dependencies,
was not found."
What's with the Assembly Stuff?
***********************************/

Nicholas Paldino [.NET/C# MVP] wrote:
Unfortunately, without theat assembly stuff, it will be difficult to
determine what the problem is.

Can't you reproduce it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Obinna" <ob**************@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Well I wrote this code that saved a Serialized ArrayList to disk in
VB.NET and tried to read it in with another one in C#. Got some funny
exception about my Assembly (can't rember exactly), what's with the
assembly stuff.


Jun 26 '06 #6

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

Similar topics

4
by: Arran Pearce | last post by:
Hi, I have just looked at serialization (to a file) and was surprised how easy it seemed to be. Are there any issues when serializing objects? or is it really just that easy and powerful and I...
5
by: francois | last post by:
First of all I would to to apologize for resending this post again but I feel like my last post as been spoiled Here I go for my problem: Hi, I have a webservice that I am using and I would...
11
by: ajou_king | last post by:
I was running some tests on my Win32 1GHZ processor to see how long it would take to transmit objects numerous times via TCP/IP using C# ..NET Remoting vs the C++ trustworthy method of binary...
4
by: Brian Keating | last post by:
wonder if anyone can help me here, i've a framework 1.1 dataset which i serialize in framework 1.1 and deserialize in framework 2.0. This is fine, problem is that i want to modify some of the...
7
by: schoenfeld1 | last post by:
I've implemented IPC between two applications using named pipes and binary serialization, but have noticed that the binary formatter is rather slow. It seems that the binary formatter reflects...
0
by: Arthlan | last post by:
Hi I'm very new to VB.net and I'm trying to understand an XML serialization example in the book I'm going through. The book is OOP by Robin A. Reynolds-Haertle. The example is in chapter 13. I...
8
by: ashoksrini | last post by:
Hi All, I have the below requirement and would like to get some feeback from the group on the best way to implement: 1. I have WSDL defined exposing few web services. 2. We dont have a...
0
by: crazyone | last post by:
I've got a gaming framework i'm building and i want to save myself the trouble of reading and writting the complete game data to a custom file and load/save it to an XML file but i'm getting...
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). ...
0
by: JosAH | last post by:
Introduction Upon hearing the word, "Serialization", the first question which comes to mind is ... "What is Serialization?" We know that we can create resusable objects in Java. But the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.