iserializable

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 different form in the same application, and it properly passes the array of objects (typ...

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

Hi folks, what's the difference between using the Serializable attribute and implementing the ISerializable interface? Please clarify. TIA ...

Deserializing a struct with SoapFormatter

I added a new member to an existing class that's serialized. The SoapFormatter was used on released versions, so this can't be changed. The main problem is deserializing old versions that don't have this new member. The new problem is when ISerializable is added to the class, structs in that class can no longer be deserialized. I get...

ISerializable and backward compatibility

hello 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 <serializable()>public MainClass ....... end class and the serialization code dim b as new binaryformatte...

ISerializable and OnSerializingAttribute

I have a type that both implements ISerializable and defines a method adorned with the OnSerializingAttribute. I have noticed that ISerializable.GetObjectData is called before the OnSerializing callback. This seems wrong to me because it renders the OnSerializing callback redundant. After all, there's no point in making preparatory ad...

Resolving Circular References for Objects Implementing ISerializable

I'm writing my own IFormatter implementation and I cannot think of a way to resolve circular references between two types that both implement ISerializable. Here's the usual pattern: [Serializable] class Foo : ISerializable { private Bar m_bar; public Foo(Bar bar) { m_bar = bar; m_bar.Foo = this; } ...

ISerializable: Assign an existing object on deserialization

Hello overflow, 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 fields some of the IDItems. The IDItems implement the ISerializable interface...

Medium Trust with ISerializable

I'm running a site in medium trust, one class implements ISerializable. Eberything works fine locally, but on the server, I get the error: Inheritance security rules violated while overriding member: 'User.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibili...

How to implement ISerializable in F#

Let's say you start off with this stub: [<Serializable>] type Bounderizer = val mutable _boundRect : Rectangle new (boundRect : Rectangle) = { _boundRect = boundRect ; } new () = { _boundRect = Rectangle(0, 0, 1, 1); } new (info:SerializationInfo, context:StreamingContext) = { // to do } interface ISerializable with member...

Is there a shortcut to binary-serialize every property in an object?

Hi, If there is an object in which every public property must be serialized and properties are simple (just numbers or strings or objects already implementing ISerializable), is there an easy way to do it without having to create GetObjectData(SerializationInfo info, StreamingContext context) and a constructor taking SerializationInfo a...

How to structure classes to Implement IEquatable and ISerializable

Hi Good Sirs. Been banging my head on this for a while now The problem I have is trying to add the IEquatable behaviour so my derived classes can use set operations Intersect of ILink etc. At the moment I have... public interface ILink { int Linkid { get; set; } bool IsActive { get; set; } } and a bunch of derived classes l...

How to Serialize collection

I have class with property of type ISet. I want to serialize that class but don't know how to do with ISet. [Serializable] class Question: ISerializable { private int id; public int Id { get{return id;} set{id = value;} } private ISet answerChoice; public ISet AnswerChoices { get{return answerChoices;} s...

Using WCF DataContract in MVC SessionState using AppFabric cache

Hi, 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 are marked with the [DataContract] attribute. The web is using the AppFabric Cache (...

Passing recursive collection through WCF

I want to pass a fairly generic set of data through a WCF method. The data is basically just a hierarchical set of key/value pairs, but it's nested to an arbitrary level. I originally considered passing it though as a single string and doing XML or JSON or similar encoding/decoding at either end, but since the WCF transport is XML anyw...

Error: "The deserializer has no knowledge of any type that maps to this contract" ?

I have a class Foo marked [Serializable] and implementing ISerializable. I'm trying to serialize it via DataContractSerializer. In GetObjectData I do this: info.AddValue("Test", new[] { 1,2,3}); It fails with: Element ':Test' contains data of the 'http://schemas.microsoft.com/2003/10/Serialization/Arrays:ArrayOfint' data contract....

How often should each object's GetObjectData method be called during custom serialization?

I'm serializing the data in my app using custom serialization i.e. each of the classes I'm storing has the [Serializable] attribute and implements ISerializable. The object graph being serialized is reasonably complex with lots of cross-references between the objects/classes. The serialization works, but it's pretty slow. :( By putting ...