serialization

Spring Remoting Serialization and De-serialization

We have been using Spring Remoting in our project for sometime. It is used with some other systems to access our web-services. We are currently evolving in terms of what parameters web service takes; but at the same time we are trying to be independent of our consumers. So, currently my question is around how serialization and deserial...

[c#] Serialize a Static Class?

What happens if we serialize a static class? Can more than one instance of the static class be created if we serialize it? [Serializable] public static class MyClass { public static MyClass() { } public static bool IsTrue() { return true; } } Suppose I XmlSerialize the object to a XML file, and at a la...

Deserializing empty xml attribute value into nullable int property using XmlSerializer

Hello, I get an xml from the 3rd party and I need to deserialize it into C# object. This xml may contain attributes with value of integer type or empty value: attr=”11” or attr=””. I want to deserialize this attribute value into the property with type of nullable integer. But XmlSerializer does not support deserialization into nullable ...

How to serialize Color property as ARGB values?

I'm working with Windows Forms designer. It serializes properties of type Color as known name whenever possible. I need it to serialize such properties always as RGB, because I need it later for interop with other system, which can deserialize only from RGB values. Is there a way to serialize Color properties always as RGB values? ...

SerializationException from System.Web.UI.Page.SaveAllState() on a member marked with NonSerializedAttribute

I get a serialization error on a page containing a custom control. the control has a member (dataContext) of a type (EntityContext) that is non-serializable, and marked as such. this is the error: Type 'Entities.EntityContext' in Assembly '...' is not marked as serializable. [SerializationException: Type '...Entities.Enti...

Enforce Object Property to be serializable

I am building a class and in the interface for my class(es) I have a property declared object MyObject { get; set; } What I want to do is force whatever is stored in MyObject to be serializable. Is there a good way to do this? Normally, I'd use where : ISerializable, but for serialization you use an attribute, not inheritance, or at...

How can I substitute a property during serialization with DataContractSerializer?

I have a working ChangeTrackingList implementation which does its job just fine, but I'd like to "filter" its contents when sending it from the client back to the server so that it only includes the changes. Getting the changes is easy, as my list exposes a GetChanges method for just that purpose. How can I interrupt the DataContractSeri...

Marshalling vs ActiveRecord Serialization in Ruby On Rails

What is the difference between Marshalling and ActiveRecord Serialization? Is there any particular occasion when it is preferable to use one over the other to save an object to the database? ...

Tokyo Cabinet and variable size C++ objects

I'm building a system, with C++, that uses Tokyo Cabinet (original API in C). The problem is I want to store a class such as: class Entity { public: string entityName; short type; vector<another_struct> x; vector<another_struct> y vector<string> z; }; The problem is that vectors an...

XML Serialize large collections of objects

What is the best way to serialize a large collection of objects? I am attempting to serialize and validate against a schema a large collection of items about 70,000 items in c#. XML file is not created. I have tried with a 1,000 items, it works fine with less items. public void SerializeObject( Ojbect MyObj) { XmlSerializer serialize...

.NET to Java serialization/deserialization compatibility

Are there any compatibility issues to take care of when serailizing an object in .NET and then deserializing in Java? I am facing problems in de-serializing an object in java which has been serialized in .NET Here is the detailed problem statement: In .NET platform i have a cookie. 1. Cookie is serialized 2. then it is encrypted us...

Can I preserve object references duing manual serialization?

Using the DataContractSerializer, I can serialize an object graph, while maintaining object references by setting "PreserveObjectReferences". This works great for most of my object graph, but there is one spot where I have to do the serialization myself. Is there any way for me to hook into the reference preservation system myself? How c...

Constructing a DateTime one step at a time.

Hi, I am trying to construct a DateTime in C# one step at a time, as in, the whole date not being in the constructor. I'm not understanding what is wrong though. DateTime d = new DateTime((long)0); d.AddYears(2000); with that d.Years will still be equal to 1 though. Also, I must store the date as a long. So I can't just build the date...

IDeserializationCallback vs OnDeserializedAttribute

As far as I understand, the IDeserializationCallback interface and the OnDeserialized event can both be used when an object needs to perform some task after being deserialized. IDeserializationCallback: [Serializable] public class Foo : IDeserializationCallback { public void OnDeserialization(object sender) { // initia...

WCF Problem Serializing a Message Header

Hi guys I have the following code: public virtual void Initialise() { this.AddHeader("SystemContext", this.UserSettings.SystemContext); } public virtual void AddHeader(string key, object value) { var customHeader = MessageHeader.CreateHeader(key, this.SystemSettings.SystemServiceNamespace, value); OperationContext.Current...

Why isn't every type of object serializable?

Why isn't every type of object implicitly serializable? In my limited understanding, are objects not simply stored on the heap and pointers to them on the stack? Shouldn't you be able to traverse them programatically, store them in a universal format and also be able to reconstruct them from there? ...

Versioned Serialization in Java

I have a simple Java class that I need to serialize to be stored as a value in an RDBMS or a key-value store. The class is just a collection of properties of simple types (native types or Maps/Lists of native types). The issue is that the class will likely be evolving over time (likely: adding new properties, less likely but still poss...

How do I customize my type's XAML attribute representation?

Say I have a Date, or a Phone number, or some Class which I don't actually want to store as a string at runtime, but which could have a nice short string serialization for serialization as a XAML attribute: <Person PhoneNumber="+1-123-123-1234"/> How do I make my type serialized in that representation? ...

PHP 5 - serializing objects and storing their relationship

I am writing a fairly complex PHP applications where a single user action can trigger changes in many other sub-systems, and I'm contemplating using an observer pattern. However, I am wondering if I have to re-create all the objects involved. Is it possible to while serializing objects to store their relationships? For example $equipm...

WPF Override XamlWriter

Hi, I need to override the behaviour of XamlWriter when writing out a user control to file. I have control which is just a grid with pictures in, the usercontrol has the grid and 4 properties which set the images. When i use XamlWriter.Save it returns the inner xaml (which includes the grid etc) of the user control, however I just wa...