serialization

What data is passed in Serialization? (Binary Serialization)

Hi all, In serialization (Binary Serialization) what data is being transferred? An instance of a class (object) or values assigned to that object's properties. I want to know what happens in the serialization process basically? I mean an object is converted to it's target file or whatever in serialization. But how? What steps are follo...

What's up with the [OptionalField] Attribute?

As I understand it I have to adorn a new member in a newer version of my class with the [OptionalField] Attribute when I deserialize an older version of my class that lacks this newer member. However, the code below throws no exception while the InnerTranslator property was added after serializing the class. I check for the property to ...

XmlSerializer and controlling namespace in XmlAnyElement

using dotnet 2.0. Code to illustrate : Class1 c1 = new Class1(); c1.SomeInt = 5; XmlDocument doc = new XmlDocument(); doc.LoadXml("<anode xmlns=\"xyz\" ><id>123</id></anode>"); c1.Any = new XmlElement[1]; c1.Any[0] = (XmlElement)doc.DocumentElement; XmlSerializer ser = new XmlSerializer(typeof(Class1)); XmlSerializ...

C5 collection library - serialization problem over WCF

I am trying to send a TreeDictionary from the C5 collection library over WCF. It gets to the recipient ok (I had to add a lot of KnownType attributes for what seems to be internal data structures) however now I am stuck at a point where it fails because it cannot create a default comparer for C5.KeyValuePair'2[typea,typeb] Is this beca...

Use .ascx to render content from ajax call.

Assume I have on a page an article with the possibility to comment it. I have a submit form that submits via ajax and the OnComplete javascript method intercepts the result of the form submit. Each comment is smth like: <div class="text"> <p class="details"> User <a href="http://www.mywebsitehere.com/user/3583/" rel="nofollow" class="f...

WCF serialization problem using NameValueCollection

I'm trying to serialize a NameValueCollection over WCF. I keep getting exceptions telling me to add one type after another. After adding them, I finally get Type 'System.Object[]' cannot be added to list of known types since another type 'System.Collections.ArrayList' with the same data contract name 'http://schemas.microsoft.com/20...

Serialization in WCF/LINQ to SQL

I created my dbml file with the tables that i need. One of the method generated is as such, names have been changed and it is not syntactically correct. But my code compiles with the original method created. [Association(Name="Clients_ToEmployee", Storage="_ToEmployees", ThisKey="ClientID", OtherKey="ClientID")] [DataMember(Order=70, Em...

MsmqIntegrationBinding Serialization with Unknown Message Body Types

I'm looking to use the MsmqIntegrationBinding to integrate with a legacy queue which has a serialized object as the message body. Has anyone come up with a way to obtain the "metadata" of the message body and create a service side class to use within the service? For example, if I put in a serialized Product object from System A and my...

How to send a Class over the wire

Hi, I have the following problem: I want to send a type (java.lang.Class) over the wire and 'define' the class on the other side. I tried like that: ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(MyClass.class); and on the receiving end: ByteArrayInputS...

Renaming fields then deserializing in C#

I have data stored in an instance of a class which has been serialized with the .net BinaryFormatter. I now want to rename one of the fields in the class, but still be able to deserialize the old data. One option is to implement ISerializable and deserialize all the the fields of the class manually. But this seems like a lot of work, ...

Want to serialize/deserialize object to/from XML - is it a good idea to specify tags as string constrants?

I have a class that I want to have opportunities to serialize/deserialize. It implements interface IXMLConvertable: public interface IXMLConvertable<T> where T: new() { T deserialize(XElement element); void serialize(XElement element); } when T is a type of object to deserialize. The question is whether it`s a good practice or...

Xml serialization library for iPhone Apps

Apple provides the NSArchiver and NSUnachriver for object serialization / deserialization, but this can not handle any custom xml schema. So filling an object structure with the data of any custom xml schema has to be made manually. Since the iPhone developer community is rapidly growing, a lot of newbie programmer are despairing to deal...

Is there an easy way to output a human readable object graph (specifically for an exception)

I have a unhandled exception handler (an oxymoron if ever there was one) but I'd like to get more information out of it. At the moment it logs the exception message, stack trace etc. and recursively does the same for any inner exceptions. However often the exception is a derived type of the exception class and therefore I do not know a...

Opinions on Expression Tree Serialization Library from CodePlex?

did someone tried this code library and have opinion about it? http://code.msdn.microsoft.com/exprserialization 10x ...

C# automatic property deserialization of JSON

I need to deserialize some JavaScript object represented in JSON to an appropriate C# class. Given the nice features of automatic properties, I would prefer having them in these classes as opposed to just having fields. Unfortunately, the .NET serialization engine (at least, by default) totally ignores automatic properties on deserializa...

Java classes that implement the Serializable interface

I need a list of classes that implement Serializable. Could you also tell me what kind of classes implement that interface? ...

In java, how to check if a method m changed the state of its receiver

I am trying to write a method which receives a serializable object (implements Serializable) o and a method m. The method should compare the state of o before invoking m and after invoking m, and tell if invoking m changed o. It should check if the bits representing o were changed after the methods. Ho can I do it? ...

Custom foreach results for dynamic proxy class - magic methods?

I need to serialize a proxy class. The class uses __set and __get to store values in an array. I want the serialization to look like it is just a flat object. In other words, my class looks like: class Proxy { public $data = array(); public function __get($name) { return $data[$name] } } and I want a foreach ...

How to serialize custom data from database?

I've a table like this : ID Name Key Value 1 Mydata1 Mail myval1 1 Mydata1 Name myval2 1 Mydata1 Nick myval3 1 Yourdata key2 myval4 and a class like this : [Serializable] public class Mydata { public string Mail{get;set;} public string Name{get;set;} public string Nick{get;set;} } I extract from my Tab...

How to serialize only certain object properties.

Given such object: Foo foo = new Foo { A = "a", B = "b", C = "c", D = "d" }; How can I serialize and deserialize only certain properties (e.g. A and D). Original: { A = "a", B = "b", C = "c", D = "d" } Serialized: { A = "a", D = "d" } Deserialized: { A = "a", B = null, C = null, D = "d" } I have wro...