serialization

Can I serialize Anonymous Types as xml?

I understood that anonymous types are marked private by the compiler and the properties are read-only. Is there a way to serialize them to xml (without deserialize) ? It works with JSON, how can I do it with XML? ...

WCF DataContract serialization with Collections

Hi, I have a simple DataContract class that contains an array of another DataContract class. When it's serialized, the resulting XML contains the array, but every tag first starts with "a:" (example: <a:name>test</a:name>). Is there a way to tell the serializer to ommit those? Thanks! ...

Delphi: Transporting Objects to remote computers

Hallo. I am writing a tier2 ordering software for network usage. So we have client and server. On the client I create Objects of TBest in which the Product ID, the amount and the user who orders it are saved. (So this is a item of an Order). An order can have multiple items and those are saved in an array to later send the created ord...

How to serialize Nullable<bool> ?

I want to serialize a nullable bool simply by converting it to a string public static string SerializeNullableBoolean(bool? b) { if (b == null) { return "null or -1 or .."; // What to return here? } else { return b.ToString(); } } What is the most appr...

Set Attribute @ run time

I have a class with a property in it.I want to know if we can set the attribute such as XmlAttributeAttribute.AttributeName. Here the ElementName attribute is set at compile time,i want top know can we set @ run time. public class MyTestClass { [XmlElement(ElementName = "MyAttributeName")] public int MyAttribute { ...

XmlSerializer.Deserialize() is too slow with files over 1MB - .Net compact framework 3.5 sp1

Hi, I got a XML schema for which I used xsd.exe to generate a Class FooClass. I am receiving xml requests from host which I get them from a directory and use the XmlSerializer.Deserialize() to get a Instance of my FooClass. Well, this worked till now perfectly and it still does, but suddenly I started to get XML files which are larger...

Clone Whole Object Graph....

While using for an object this code to serialize it: public object Clone() { var serializer = new DataContractSerializer(GetType()); using (var ms = new System.IO.MemoryStream()) { serializer.WriteObject(ms, this); ms.Position = 0; return serializer.ReadObject(ms); ...

Serialization over Pipes

I wrote several simulation programs in C++ and want to connect their outputs/inputs with pipes (best solution would probably be to use the C++ streams). For this I would like to serialize some objects (for example the simulations output/input are tensors and matrices). How should I handle this problem? I searched around for some time fo...

How to convert Objective C textual (po) representation to real object

Hi, In xcode you can use po object to see a textual representation of a given object. Is it possible to convert from this textual representation to a real objective c object? Thanks ...

Is it possible to pass an instance "pointer" to another process through a memory mapped file?

I'm basically searching for a way to pass instances across programs/processes without serializing the instances, in .NET 4.0. Yes, I'm missing my good ol' 100% unsafe pointers ;) I thought the new integration of Memory-mapped files to .NET 4.0 would help me, having read somewhere that you could pass references/pointers "natively" using...

Android: Serializing video files

I want to send video files from the Android via network to server. How can I serialize video files in Android? ...

Java Object to XML serialization using writeObject

Is there any open source Object to XML serializer in Java that uses writeObject method on the object to serialize similar to NSXMLOutputStream in WebObjects? ...

Designer serialization persistence problem in .NET, Windows Forms

ETA: I have a similar, smaller, problem here which, I suspect, is related to this problem. I have a class which has a readonly property that holds a collection of components (* not quite, see below). At design time, it's possible to select from the components on the design surface to add to the collection. (Think imagelist, but instead ...

How to clone objects in NHibernate?

How to implement cloning of objects (entities) in NHibernate? In the classes of entities has properties such public virtual IList<Club> Clubs { get; set; } All classes are inherited from BaseObject. I tried to implement using xml serialization, but the interfaces are not serialized. Thank you for your answers! ...

Problem with persisting a collection, that references an internal property, at design time in winforms, .net

(I've answered the question below with a hack. I'm fairly confident in it unless MS change the way that codedom serializers the designer code.) ETA2: I've worked out what is going on. I wondered why sometimes it would work and not others. It boils down to the name that I give to the internal property and the collection. If I rename th...

C# "Enum" Serialization - Deserialization to Static Instance

Suppose you have the following class: class Test : ISerializable { public static Test Instance1 = new Test { Value1 = "Hello" ,Value2 = 86 }; public static Test Instance2 = new Test { Value1 = "World" ,Value2 = 26 }; public String Value1 { get; private set; } public int Value2 { get; private set; } publi...

Object Serialization for Undo/Redo Functionality Java

I have been trying to implement and undo/redo system in a game I am coding in Java. I am taking the approach of serializing the state of the game after each move. I there a way of saving the serialized objects on a stack and accessing them for undo/redo? ...

Is is better to store serialized data or raw html in mysql?

I de-normalized my database, since the application was crawling otherwise, and Im storing a list of categories for each item in the DB as a raw html version, and simply echoing it out in my design. Each category is actually a link, which is include a tag. Naturally, this is abit of a pain, especially if I want to change the look of how...

Serialization problem

Hi Is it possible to break the serialization in following scenario? GetObjectValue(StreamingInfo info, ....) { info.AddValue("string1", subobject1); info.AddValue("string2", Subobject2); . . } Now my scenario is after serializing subobject1, if the size of the stream exceeds some size limit, can i stop serializing rem...

Pipe transfer blocks when writing object with small pipe size

Hi everyone, I'm having a bit of problem with an example I'm currently testing. For some reason, the execution blocks when writing at oos.writeObject(new SimpleObject());, despite that fact that the pipe should transfer the data across, even (I'd assume) if it had to do it in smaller operations due to a small pipe size. Anyway, the examp...