Questions tagged [binary-serialization]

The process of translating data structures or object state into a binary format

Serialization can be defined as the process of storing the state of an object to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created.

http://en.wikipedia.org/wiki/Serialization
http://msdn.microsoft.com/en-us/library/72hyey7b(v=vs.110).aspx

178 questions
0
votes
3 answers

Skip elements during deserialization with BinaryFormatter

Is there a possibility to skip the next 'entry' of a serialized stream when deserializing? Regarding a plugin-oriented architecture it can happen that distinct parts of a serialized object graphs might become unknown types in another environment…
mvo
  • 1,138
  • 10
  • 18
0
votes
0 answers

the binary formatter serialized strings can directly be seen in the written file loaded by notepad?

I have tried to serialized a big class with a lot of strings by binary formatter using C#: using (FileStream savedfile = new FileStream(FilePath, FileMode.Create, FileAccess.Write)) { BinaryFormatter bf = new BinaryFormatter(); TheInfo info =…
Flysword
  • 13
  • 4
0
votes
0 answers

C# BinaryFormatter deserialize as an existing object

Using BinaryFormatter, how could I override the deserialization method of a class so that it would return an existing instance of this class instead of create a new one?
tbkn23
  • 5,205
  • 8
  • 26
  • 46
0
votes
1 answer

SerializationException when deserializing

This code deserialize object from SQLite. I'm get serialized object from DBinaryData (BLOB) field. But get System.Runtime.Serialization.SerializationException: end of stream encountered before parsing was completed. How to fix this? public void…
Relrin
  • 760
  • 2
  • 10
  • 28
0
votes
2 answers

difference of two methods for converting byte[] to structure in c#

I'm doing some conversions between some structures and thier byte[] representation. I found two way to do this but the difference (performance, memory and ...) is not clear to me. Method 1: public static T ByteArrayToStructure(byte[] buffer) { …
Hossein Narimani Rad
  • 31,361
  • 18
  • 86
  • 116
0
votes
1 answer

SurrogateSelector seems to work only on the root object

I try to use SurrogatSelector to customize the deserialisation of a stream. It works fine for the root object of the object graph but not for contained objects. See the following code: Stream stream = File.Open("C:\\Temp\\test.bin",…
Gerhard
  • 1,342
  • 2
  • 12
  • 23
0
votes
2 answers

What are possible causes of binary stream corruption?

I am trying to learn how to do binary serialziation. This exception gets thrown every time I try to deserialize an object I previously serialized: Binary stream '161' does not contain a valid BinaryHeader. Possible causes are invalid stream or…
irfanka
  • 129
  • 1
  • 14
0
votes
1 answer

serialize list contain hash table

i have a class which has a string and a hash table.hash table contains set of key(string) values and bitmap file for each key attribute. how do i serialize this into binary file? public void SerializeObject(List poems) { using…
Hashan
  • 185
  • 2
  • 2
  • 8
0
votes
1 answer

Silverlight Binary Serialization over the wire

While nearly completing a new release, we've ignored the large size of the XML data that our WCF service returns to our silverlight client. Now we're investigating how to shrink the data, so that the results aren't in the 10-100mb range. Its seems…
Nathan
  • 75
  • 1
  • 6
0
votes
3 answers

Serializing java.lang.class

I have a problem persisting the Class object in the DB. I tried to convert the object into a byte array using object ObjectArrayOutputStream and ByteArrayOutputStream as shown below and persisted it the byte array: Class klazz =…
promaxdev
  • 455
  • 1
  • 6
  • 19
-1
votes
1 answer

Creating an object of my custom class from a string

I'm working on a game using Unity Engine and C#. I'm a beginner. I've created a Custom class called "Item" deriving from scriptable objects that is the basis of items in my game. An object of type Item is held in the 'Inventory', another class,…
-1
votes
1 answer

Convert BinarySerialized Byte Array to readable string

When you binary serialize an object in .Net using the BinaryFormatter you end up with a byte array which is obviously meaningless to humans. Does this byte array correspond to a more meaningful string representation which is human readable? Or do…
Yair Halberstadt
  • 5,733
  • 28
  • 60
-1
votes
1 answer

ISerializable for Collection

I am writing the serialization code for a Collection class and would like to know how to set and get the items in the collection. I am using Binary serialization. I have made an attempt in the following code, but am not sure on the correct…
Simon
  • 7,991
  • 21
  • 83
  • 163
1 2 3
11
12