Questions tagged [iserializable]

54 questions
75
votes
5 answers

What's the difference between using the Serializable attribute & implementing ISerializable?

What's the difference between using the Serializable attribute and implementing the ISerializable interface?
SoftwareGeek
  • 13,780
  • 18
  • 57
  • 78
55
votes
4 answers

What is the point of the ISerializable interface?

It seems like I can serialize classes that don't have that interface, so I am unclear on its purpose.
leora
  • 163,579
  • 332
  • 834
  • 1,328
12
votes
2 answers

Deserialization constructor not called

I am attempting to serialize/deserialize an object that contains a Dictionary. These are both custom types. In my code I have a type of Template which contains the Dictionary. It is the Template class that I am attempting…
Remotec
  • 8,966
  • 20
  • 93
  • 139
10
votes
1 answer

Deserialization of an array always gives an array of nulls

I have a custom abstract base class with sub classes that I've made serializable/deseriablizeable with ISerializable. When I do serialization/deserialization of single instances of this class' sub classes, everything works fine. However, when I do…
vesz
  • 265
  • 5
  • 11
8
votes
3 answers

Cross-Process Drag and Drop of custom object type in WinForms C#

This question is close to what I'm interested in, but not quite. I have a .NET WinForms application written in C#. I have a ListView control which displays an array of C# objects. I've hooked it up so that you can drag/drop these listview items to a…
EricLaw
  • 54,427
  • 7
  • 140
  • 182
6
votes
5 answers

ISerializable and backward compatibility

I have to work an an old application that used binaryFormatter to serialize application data into filestream (say in a file named "data.oldformat") without any optimizazion the main class has been marked with attribute public…
5
votes
1 answer

Problem deserializing with NetDataContractSerializer after refactoring code

I have a situation where I'm serializing some .NET objects using NetDataContractSerializer and storing the XML in a database as a way to remember the state of these objects within an application. Recently I just came across the first situation where…
jpierson
  • 13,736
  • 10
  • 94
  • 137
5
votes
2 answers

Using WCF DataContract in MVC SessionState using AppFabric cache

I have a Data Access Layer, a Service Layer, and a Presentation Layer. The Presentation Layer is ASP.NET MVC2 RTM (web), and the Service Layer is WCF (services). It's all .NET 3.5 SP1. The problem is that in the services, the objects being returned…
5
votes
0 answers

custom serialization - ISerializable and protected/private constructor to deserialization

I don't understand how it works: when I implement ISerializable interface I have to define protected (unless the class is sealed, in which case the constructor should be marked private) constructor: protected MyClass(SerializationInfo info,…
user2551229
  • 315
  • 3
  • 11
4
votes
1 answer

Serialization of List using ISerializable

Thanks for taking a look! I'm working on a new version of a product that is deployed in the field. I need to maintain the ability to deserialize exiting files from the older software. Here is a contrived example: I have a existing customer base…
Brandon
  • 1,084
  • 8
  • 12
4
votes
1 answer

ISerializable with recursive children

I'd like to implement ISerializable for a C# class which contains a list of similar typed children. Consider the following example: using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; using…
4
votes
0 answers

Why does System.Delegate implement ISerializable?

If you look at the sources for System.Delegate you'll see that it implements ISerializable interface: [Serializable, ComVisible(true), ClassInterface(ClassInterfaceType.AutoDual),__DynamicallyInvokable] public abstract class Delegate : ICloneable,…
rbm
  • 3,113
  • 2
  • 15
  • 27
4
votes
2 answers

ISerializable: Assign an existing object on deserialization

our task is quite simple, we have an object graph where each object (IDItem) has a unique ID. The object graph exists two times, on the client and on the server machine. Now we pass some serializable commands to the server. The command has as…
thalm
  • 2,449
  • 1
  • 27
  • 45
4
votes
3 answers

Serialization when extending a class whose GetObjectData method is not marked virtual

I'm trying to extend a framework. One of the classes I am extending is serialized. The base class' GetObjectData() method is not marked virtual so I can't override it. Now if object gets serialized when it's referenced as a base class it's not…
kramar
  • 53
  • 1
  • 6
4
votes
1 answer

ISerializable - Serializing singletons

The ISerializable interface only provides a method to serialize the object. The deserialization process is managed by a constructor. The problem is, that constructor cannot return an instance, because the constructor CREATES a new instance. In my…
user1275011
  • 1,129
  • 1
  • 10
  • 28
1
2 3 4