473,406 Members | 2,356 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.

Serialize Structure

I would like to serialize a custom structure eg.

Private Structure Dog
Dim DogName As String
Dim DogAge As Integer
Dim Fleas As ArrayList
End Structure

I am using a BinaryFormatter() to serialize the data. Each Dog is added to a
HashTable, and then the final HashTable is serialized... well that is the
intention.
Why does it come up with following error : PublicKeyToken=null' is not
marked as serializable

Any help on achieving this task or pointers would be helpful
Scott
Jun 16 '06 #1
2 1832
Try adding the SerializableAttribute to the structure:
<Serializable()>
Private Structure Dog
Dim DogName As String
Dim DogAge As Integer
Dim Fleas as ArrayList
End Structure

You can mark individual fields as un-serializable with the
NotSerializableAttribute.
--
http://www.peterRitchie.com/
"Scott Collier" wrote:
I would like to serialize a custom structure eg.

Private Structure Dog
Dim DogName As String
Dim DogAge As Integer
Dim Fleas As ArrayList
End Structure

I am using a BinaryFormatter() to serialize the data. Each Dog is added to a
HashTable, and then the final HashTable is serialized... well that is the
intention.
Why does it come up with following error : PublicKeyToken=null' is not
marked as serializable

Any help on achieving this task or pointers would be helpful
Scott

Jun 16 '06 #2
Thanks Peter, I didn't think it was going to be that easy - but it worked.

Scott
"Peter Ritchie" <PR****@newsgroups.nospam> wrote in message
news:5A**********************************@microsof t.com...
Try adding the SerializableAttribute to the structure:
<Serializable()>
Private Structure Dog
Dim DogName As String
Dim DogAge As Integer
Dim Fleas as ArrayList
End Structure

You can mark individual fields as un-serializable with the
NotSerializableAttribute.
--
http://www.peterRitchie.com/
"Scott Collier" wrote:
I would like to serialize a custom structure eg.

Private Structure Dog
Dim DogName As String
Dim DogAge As Integer
Dim Fleas As ArrayList
End Structure

I am using a BinaryFormatter() to serialize the data. Each Dog is added
to a
HashTable, and then the final HashTable is serialized... well that is the
intention.
Why does it come up with following error : PublicKeyToken=null' is not
marked as serializable

Any help on achieving this task or pointers would be helpful
Scott

Jun 17 '06 #3

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

Similar topics

5
by: Alfonso Morra | last post by:
Hi, I am writing a messaging library which will allow me to send a generic message structure with custom "payloads". In many cases, a message must store a non-linear data structure (i.e....
14
by: vince | last post by:
Can I add (append) to an xml file that already contains a serialized object, and be able to deserialize to either or both objects from the same file...??? How is this done...?? thanks, vince
3
by: MAY | last post by:
Hi, I have a problem about serialize the form controls. I wrote a test program to test serialize a from but fail (->An unhandled exception of type...
3
by: ~~~ .NET Ed ~~~ | last post by:
Hello, I am having a problem trying to serialize this simple structure, I use it in a collection class that derives from CollectionBase but I noticed that at least for now the serialization...
5
by: objectref | last post by:
Hi to all, let's say i have a form with 2 buttons and 3 textboxes on it. Is there a way to Serialize the form so when i de-Serialize and cast it to a Form, i will get back the original form with...
2
by: Dennis | last post by:
Does anyone know why this code gives an error: <serializeable> public structure TestSerialize anumber as integer astring as string end strucuture Dim t As TestSerialize Dim formatter As New...
10
by: Uma - Chellasoft | last post by:
Hai, I am new to VB.Net programming, directly doing socket programming. In C, I will be able to map the message arrived in a socket directly to a structure. Is this possible in VB.Net. Can...
4
by: teddysnips | last post by:
I would like to serialize a class to XML. The format of the XML is fixed (see below). It only needs to be serialized - it is read by another application. I know I can do it manually using...
5
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post by:
Hi Willy, Thank you very much for your work. C++ code doesnot make any serialization. So at runtime C# code gives an serialization error at "msg_file_s sa = (msg_file_s) bf.Deserialize(ms);"...
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
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?
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
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
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
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...
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.