Serialize Structure

  • Thread starter Thread starter Scott Collier
  • Start date Start date
S

Scott Collier

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
 
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.
 
Back
Top