Questions tagged [iserializable]
53 questions
78
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
- 15,234
- 19
- 61
- 78
58
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
- 188,729
- 360
- 878
- 1,366
19
votes
1 answer
Sonarcube does not like my implementation of serializable exception class
SonarCube shows me error "Update this implementation of 'ISerializable' to conform to the recommended serialization pattern" for the following exception implementation:
[Serializable]
public class UnrecoverableException : Exception, ISerializable
{
…

YMC
- 4,925
- 7
- 53
- 83
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
- 10,304
- 25
- 105
- 147
11
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…

hillsprig
- 307
- 5
- 12
9
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
- 56,563
- 7
- 151
- 196
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…

pierusch
- 137
- 11
6
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
- 355
- 5
- 13
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
- 16,435
- 14
- 105
- 149
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…

jamiebarrow
- 2,473
- 3
- 30
- 51
5
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,552
- 1
- 16
- 36
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,239
- 9
- 17
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…

ChocolatePocket
- 71
- 7
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,243
- 2
- 17
- 28
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,738
- 2
- 35
- 49