serialization

Mismatched group tags detected in message - protobuf-net

I’m quite new to Silverlight. I’m working for a project which mainly depends on Serialization and Deserialization. Formerly, for WPF I was comfortable with Serializable classes. For silverlight, I found protobuf would be quite useful. But, I'm troubled with this exception. I don't know what causes this problem. Please help me out. I'm...

Change the name of the class being serialized in .Net?

I can map incoming class names by using a SerializationBinder and overriding the BindToType method, but I found no way of changing the name of the class in the serialization process. Is it possible at all?? EDIT: I am referring to the serialization using the System.Runtime.Serialization, and not the System.Xml.Serialization. Thanks! ...

LinkedList<T> can not be serialized using the XMLSerializer

A LinkedList can't be serialized using XmlSerializer. Now, how to however save/retrieve data from a serialized objet LinkedList. Should I implement custom serialization? What I tried to do: using System.Xml.Serialization; [Serializable()] public class TestClass {     private int _Id;     private string _Name; private int _Age; ...

WCF deserialization of Dictionary where Enum type is key

Hello there. I would like to aks you for your help. I have here problem with WCF deserialization of Dictionary where Enum type is used as a key. I have two data objects: [DataContract] public enum MyEnum : int { [EnumMember] Value1 = 0, [EnumMember] Value2 = 1 } and [DataContract] [KnownType(typeof(MyEnum))] public cl...

Is it reliable to compare two instances of a class by comparing their serialized byte arrays?

Given two instances of a class, is it a good and reliable practice to compare them by serializaing them first and then comparing byte arrays (or possibly hashes of arrays). These objects might have complex hierarchical properties but serialization should go as deep as required. By comparison I mean the process of making sure that all p...

DataContractJsonSerializer not seeing DataMemberAttribute

I've derived from ( the excellent ) PropertyBag class and then want to serialize to Json using DataContractJsonSerializer. Unfortunately the dynamic properties are not showing up in the JSON despite being created with a DataContractAttribute. How can i serialize these dynamic properties? using System; using System.ComponentModel; using...

Increasing a classes array size of a deserialized xml file

I have an XML file that I deserialize into a class object. This class contains a number of other classes, some of which are arrays. I would like to increase the array size of some of the objects. How can I do this? In the following example, the MyData object has an array size of 5 but the MyArrayClass say only has an array size of 1....

Exchanging objects between C# and C++

Imagine a project with a C# component and a C++ component. The C++ component is the old-school non .Net stuff (VC++ 6.0). What is an easy way to transfer objects between the two components? I'm tempted to use System.Xml.XmlSerializer, but I'm not sure how to start getting at the .Net libraries with this old VC++ app. Maybe there's an...

MS Project XML Serialization

I am trying to read data from an MS Project XML file. I have used the XML Schema Tool to generate a set of strongly typed classes based on the Microsoft Project 2007 XML Schema. However, I ran into several issues. The xmlns property on the root node from the XML exported from MS Project does not match the XSD schema. MS Project gener...

Serialize a DOM range

Hi, is there any standard/easy way to serialize a DOM Range (and the IE equivalent) with java script. The motivation is to store the current selection for a document together with its HTML code. I thought of using XPath for it, but before I start to reinventing the wheel maybe there is something already working available and I just ...

JSON Serializing Django Models with simplejson

I'd like to use simplejson to serialize a Django model. Django's serializer doesn't support dictionaries... and simplejson doesn't support Django Querysets. This is quite a conundrum. In the model there's sponsors that have a Foreign Key to sponsor level, I'm trying to group all the sponsors that belong to a certain sponsor level togeth...

How to add n bytes in 64 bit system

Hi, I am working in 64 bit x_86 64 bit OSX system. I am reading the file of legacy database. It is loaded to a memory block and using offsets it read to the structures. It is written in 32 bit mode. So in order to read properly in 64 bit mode, I want to add n bytes to the base address of a structure. Since pointer incement increment...

Does Order Matter in the XML Read by the DataContractSerializer?

I have the following code: [DataContract(Namespace = "")] public class User { [DataMember] public string UserName { get; set; } [DataMember] public string FullName { get; set; } } //Deserialization test public void Test() { //CASE 1. //string xml = "<User><UserName>john</UserName>" + // "<Ful...

Encryption of Objects stored to disk using C++ (for a Java Developer)

Hi All, This is two questions in one but hopefully trivial to a C++ developer. How can I seralize an object so that I can write it to disk and retrieve it later in C++ or if this is the wrong keyword how can I write an object as a binary stream and recreate it later? Can I use inheritance to make a hierarchy of classes serializable? w...

Prevent <xsi:nil="true"> on Nullable Value Types when Serializing to XML.

I have added some nullable value types to my serializable class. I perform a serialization using XmlSerializer but when the value is set to null, I get an empty node with xsi:nil="true". This is the correct behaviour as I have found here: http://msdn.microsoft.com/en-us/library/ybce7f69%28VS.80%29.aspx Is there a way to switch off thi...

Using Json.NET converters to deserialize properties

I have a class definition that contains a property that returns an interface. public class Foo { public int Number { get; set; } public ISomething { get; set; } } Attempting to serialize the Foo class using Json.NET gives me an error message like, "Could not create an instance of type 'ISomething'. ISomething may be an inter...

XML Deserialization

Hello Guys, I have tried to use the xsd.exe tool to generate a class for the following Oracle-generated xml sample but always fail to get it right when I try to change oracle xml elements names to the class's names, specifically I'm not sure how to do it for the ROWSET and ROW part of it. Being very new to the serialization/deseria...

Erlang's term_to_binary in Haskell?

Is there a no-fuss serialization method for Haskell, similar to Erlang's term_to_binary/binary_to_term calls? Data.Binary seems unnecessarily complicated and raw. See this example where you are basically manually encoding terms to integers. ...

How to create inheritance based serialization mechanism?

Hey everyone, I whould like to creat a serialization mechanism, to work on a variety of entities, all of which are based on a few base-classes. Now I want to work with DataContractSerializer, so I need to mark all my classes with [DataContract]. but I dont want to do that because that is a big room for error for other members of my tea...

What difference makes a Serialized object, as it can be persisted?

As we know Serializable is a Marker Interface(ie Interface without any methods). So i was wondering how implementing this interface makes an object of the implementing class to be persisted, As except the name Serializable nothing is there for this interface. And are there any other features we get by implementing this interface. Can...