serialization

Problem with serialization of svcutil synthetized classes

I used svcutil to generate classes to access the web service. I need to serialize them. The class is quite simple, here is how it looks [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Name="...

Deserialize xml node excluding inner nodes

I have an xml as below <Image Id="23" Name ="image1"> <Used_in Name ="Label1" /> </Image> Here Image node has been serialized as an object of Image class [XmlElement(ElementName = "Image")] public class Image { [XmlAttribute] public string Name { getter and setter } [XmlAttribute] public string ID { getter and setter } } While...

Bidirectional Serialization with Linq

Anyone know why only undirectional serialization is supported in the Linq designer? Consider the following example: Say we have a Customer who requested an Order containing Products. We set the Serialization Mode in the Linq designer to Unidirectional to enable serialization. When looking at the code for the Order object, the DataMem...

Is it possible to return a SiteMap as a JsonResult?

I've got a very simple Action on my Controller that's attempting to return my XmlSiteMap as a JsonResult: public ActionResult Index() { var nodes = SiteMap.Provider.RootNode; return new JsonResult() { Data = nodes, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } However, when I call the Action, an InvalidOpera...

Conditional deserialization

I am still not sure whether the title of my question is correct and it most probably is not. However I have spent some time searching both the net and stackoverflow and I can not find a good description of the issue I am facing. Basically what I want to achieve is the ability to read some raw bytes and based on the value of some of them...

How to deserialize implementation classes in OSGi

In an eRCP OSGi based application the user can push a button and go to a lock screen similar to that of Windows or Mac OS X. When this happens, the current state of the application is serialized to a file and control is handed over to the lock screen. In this mobile application memory is very tight, so we need to get rid of the original ...

SerializationException Occurring Only in Release Mode

Hi, I am working on an ASP.NET web app using Visual Studio 2008 and a third-party library. Things are fine in my development environment. Things are also good if the web app is deployed in Debug configuration. However, when it is deployed in Release mode, SerializationExceptions appear intermittently, breaking other functionality. In ...

Simple Serialization Faster Than JSON? (in Ruby)

I have an application written in ruby (that runs in the JRuby VM). When profiling it, I realized that it spends a lot (actually almost all of) its time converting some hashes into JSON. These hashes have keys of symbols, values of other similar hashes, arrays, strings, and numbers. Is there a serialization method that is suitable for s...

WCF - (Custom) binary serialisation.

I want to be able to query my database over the web, and I am wanting to use a WCF service to handle the requests and results. The problem is that due to the amount of data that can potentially be returned from these queries, I'm worried about how these results will be serialised over the network. For example, I can imagine the XML seria...

Serializing System.Drawing.Color in .NET

Hi all, I've used the default .NET serialization for a class with a System.Drawing.Color member. The code is now in use by people, and I need to add an extra member to the class, but still deserialize older versions. So I tried the standard way of doing this: The ISerializable interface, using SerializationInfo methods to get the int ...

Need recommendation for object serialization library in c++

Hi, I am looking for recommendation for object serialization/deserialization library in c++? Which one are the most advanced and open-sourced? Can it handle Any class that users defined? Object hierarchy (parent and child classes)? A Tree of objects? Class A has an attribute of Class B which has an attribute of Class C? STL contain...

Serialization problem

I have created a phonebook application and it works fine after a awhile i liked to make an upgrade for my application and i started from scratch i didn't inherit it from my old class,and i successes too ,my request "I want to migrate my contacts from the old application to the new one" ,so i made an adapter class for this reason in my ne...

Serializing persistent/functional data structures

Persistent data structures depend on the sharing of structure for efficiency. For an example, see here. How can I preserve the structure sharing when I serialize the data structures and write them to a file or database? If I just naively traverse the datastructures, I'll store the correct values, but I'll lose the structure sharing....

Serializing WPF DataTemplates and {Binding Expressions} (from PowerShell?)

Ok, here's the deal: I have code that works in C#, but when I call it from PowerShell, it fails. I can't quite figure it out, but it's something specific to PowerShell. Here's the relevant code calling the library (assuming you've added a reference ahead of time) from C#: public class Test { [STAThread] public static void Main() ...

not able to Deserialize xml into object

I am having following peice of code ,where in i am trying to serialize and deserailize object of StringResource class. Please note Resource1.stringXml = its coming from resource file.If i pass strelemet.outerXMl i get the object from Deserialize object ,but if i pass Resource1.stringXml i am getting following exception {"< STRING xml...

Declaring the datatype dynamically reading from an xml string

Hello I've this strange issue. I've an xml string which looks like below - <key><int>5</int></key><value><int>10</int> The above xml is obtained after serializing a Dictionary using Paul's Code. Now i want to convert the xml back to the dictionary. How can i get the type "int" from the xml and declare the dictionary as follows? Dic...

XmlSerializer throws exception when serializing dynamically loaded type

Hi I'm trying to use the System.Xml.Serialization.XmlSerializer to serialize a dynamically loaded (and compiled class). If I build the class in question into the main assembly, everything works as expected. But if I compile and load the class from an dynamically loaded assembly, the XmlSerializer throws an exception. What am I doing wr...

Deserialized xml - check if has child nodes without knowing specific type

I have deserialized an xml file into a C# object and have an "object" containing a specific node I have selected from this file. I need to check if this node has child nodes. I do not know the specific type of the object at any given time. At the moment I am just re-serializing the object into a string, and loading it into an XmlDocume...

XmlText attribute in base class breakes serialization

I have a base class with a property called Name, which has an XmlText attribute. When an inherited class is serialized I get an exception saying: There was an error reflecting type '[type name]'. ---> System.InvalidOperationException: Cannot serialize object of type '[type name]'. Base type '[base type name]' has simpleCon...

How did My Object Get into ASP.NET Page State?

I know what this error is, how to fix it, etc. My question is that I don't know why my current page I am developing is throwing this error when I am not using the foo class directly in any way, nor am I setting anything to the viewstate. I am using postbacks alot, but like I said, I am not storing anything in the viewstate etc one integ...