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
1 answer

Before completing the analysis was detected ending stream

It's me again and I have another problem. Somewhere, I've found following code: private T DeepDeserialize(string fileName) { T returnValue; using (FileStream str = new FileStream(fileName, FileMode.Open)) { …
SoptikHa
  • 437
  • 4
  • 19
0
votes
2 answers

Ordinal of enum affecting BinaryFormatter deserialization?

I am hitting a strange issue with score serialization in my game. I have a LevelHighScore class: [System.Serializable] public class LevelHighScores { readonly Dictionary scores; // clipped out the rest for…
James McMahon
  • 48,506
  • 64
  • 207
  • 283
0
votes
1 answer

ObjectDisposedException in a client server application

I've received an assignment in my C# course to build a multi-client chat in WinForms using the TcpClient / TcpServer classes with the use of Serialization & Deserialization via BinaryFormatter. When I'm using the Disconnect method from the client…
0
votes
1 answer

Converting tree view to byte[], then back again

im trying to convert a tree view to a byte array and then back again. so far when the form loads, it will load the structure of my documents. Then as far as i know it will convert it to a byte array and back but im not sure how to convert the byte…
Rachel Dockter
  • 946
  • 1
  • 8
  • 21
0
votes
1 answer

WCF nettcp traffic optimization

How to optimize traffic on nettcp binding ? One data object takes 300-1000 bytes in memory. I need transfer near 1 000 000 objects. So i can create more than 1 Gb traffic. Can length of field name influent on serialized object size ( i.e. xml…
Json76
  • 175
  • 2
  • 13
0
votes
1 answer

Binary Serialization/Deserialization with dictionaries and others class members

I need to serialize/deserialize a class with subclasses in which a member is a dictionary. Another member is a class storing passwords so it can't be XML but binary. Have found that very nice solution which might be easy and issue-free.…
Patrick
  • 3,073
  • 2
  • 22
  • 60
0
votes
1 answer

Serialize PixelFormat

I would like to serialize System.Windows.Media.PixelFormat object, and then recreate it by deserialization. What I'm doing: BitmapSource bitmapSource = backgroundImage.ImageSource as BitmapSource; PixelFormat pixelFormat =…
0
votes
3 answers

Are Enums binary serialized as numbers or as text - I want to rename them

Are Enums binary serialized as numbers or as text - I want to rename them. Example: [Flags] public enum VerticalAlignment : byte { None = 0, Centered = 1, Top = 2, Bottom = 4, Stretch = 8, All = Centered | Top | Bottom |…
Marek
  • 2,419
  • 6
  • 34
  • 38
0
votes
3 answers

Most current implementation methods for serializing objects in .NET (as of v4.0)

I have an simple custom object called MyObject (a couple of basic properties and a List(of MyObject), so it's recursive) that I need to serialize for storage. I'm not sure if I'll serialize to XML or Binary yet, but I want to make sure I'm using the…
SqlRyan
  • 33,116
  • 33
  • 114
  • 199
0
votes
1 answer

Binary serialization of whole class automatically

Is there a way to serialize/deserialize a whole class without having to specify each object. If I plan to add many more items, this will become tedious. For example: [Serializable()] public class Items : ISerializable { public…
Synaps3
  • 1,597
  • 2
  • 15
  • 23
0
votes
1 answer

Check whether binary serialized data matches the class which serialized it

The title says pretty much what I would like to know. I have data which was binary serialized and now I'm reading it again (class name remains the same) and I would like to know if the serializer misses something because, for example, a private…
DerApe
  • 3,097
  • 2
  • 35
  • 55
0
votes
2 answers

BinaryReader and while statement operators

This is not my code. I am supposed to figure out what is going on. The line of the while statement is where I am confused. Is all its trying to say is read until end of file. I don't understand how it would evaluate to some integer for comparison.…
Josh Davis
  • 90
  • 8
0
votes
3 answers

Why does he deserialize twice

This is not my code I just have to understand it. The original programmer cannot be reached. dobj is just an object type. My main question is: Why does he deserialize again when dobj was never changed? Please ignore all his goto's for right now…
0
votes
1 answer

How do you deserialize derived class while passing parameters to base class

I have a derived class that inherits from a bass class which draws a circle public BraceHole(Brace brace, Vertex centerPoint, double diameter, VDrawI5.vdEntities entities) : base(centerPoint, diameter / 2, entities) { this.brace =…
0
votes
4 answers

Malformed binary serialization of HashMap

I wrote some code to serialize a HashMap by iterating entries and serializing each of them instead of using ObjectOutputStream.readObject(). The reason is just efficiency: the resulting file is much smaller and it is much faster to…
Julián Urbano
  • 8,378
  • 1
  • 30
  • 52
1 2 3
11
12