serialization

WCF: DeSerialize string datamember as int

Hi everyone, I really can't figure this one out! (if it's even possible). From a WCF service we are receiving product information. A product datacontract has some members that are defined as strings (but are actually integers), but we want to process them as integers. When I change the datatype in the contract on the client side from...

Serializing an ObservableCollection(of T) in VB.Net

I'm trying out MVVM in VB.Net for a while now and started out with some of my entities using List(of T)s, which I xml serialized to disk. Now, I updated the classes used by the Lists to implement INotifyPropertyChanged so I also changed the List(of T)s to ObservableCollection(of T)s. After which, the XML serializer stopped working :'( A...

How do I deserialize XML namespaces in C# (System.Xml.Serialization)?

Hi, I am just putting the finishing touches to my Zthes format deserializer (System.Xml.Serialization) which uses the namespace "dc" in the element "thes". All "term" elements are deserializing fine because they have no namespace but I cannot figure out how to tell the deserializer that the "thes" elements have a namespace. Here is wha...

WCF - Generic List (of T)

I have a list of a custom DTO that I am trying to pass across to a WCF service. I am getting the following error: There was an error while trying to serialize parameter tcp://localhost/:oObject. The InnerException message was 'Type 'System.Collections.Generic.List`1[[TEGE.ER.WorkFlowEngine.WFCommon.HeartBeat.HeartBeatDTO, WFCommon, ...

Encoding an integer in 7-bit format of C# BinaryReader.ReadString

C#'s BinaryReader has a function that according to MSDN, reads an integer encoded as "seven bit integer", and then reads a string with the length of this integer. Is there a clear documentation for the seven bit integer format (I have a rough understanding that the MSB or the LSB marks whether there are more bytes to read, and the rest ...

Objective-c way of serializing arrays that contain different types

Hello, My NSMutableArray instance contains instances of different types of objects that have common ancestor. I want to serialize the array, but NSKeyedArchiver class seems to archive arrays contain certain types of objects. Is there an easy way to to this with stock serialization classes ? ...

SQLite3 for Serialization Purposes

I've been tinkering with SQLite3 for the past couple days, and it seems like a decent database, but I'm wondering about its uses for serialization. I need to serialize a set of key/value pairs which are linked to another table, and this is the way I've been doing this so far. First there will be the item table: CREATE TABLE items (id ...

JSON.net problem with JsonConvert.DeserializeObject

Hi I have the following code and json: public class Labels { public Labels() {} public Label[] Label {get;set;} } public class Label { public Label() { } public string Name { get; set; } public int TorrentsInLabel { get; set; } } //... Labels o = JsonConvert.DeserializeObject<Labels>(json); //... {"labe...

Efficiency of deserialization vs. XmlReader

I'm working with a complicated xml schema, for which I have created a class structure using xsd.exe (with some effort). I can now reliably deserialize the xml into the generated class structure. For example, consider the following xml from the web service: <ODM FileType="Snapshot" CreationDateTime="2009-10-09T19:58:46.5967434Z" ODMVer...

InvalidOperationException When XML Serializing Inherited Class

I am having an issue serializing a c# class to an XML file that has a base class... here is a simple example: namespace Domain { [Serializable] public class ClassA { public virtual int MyProperty { get; set; } } } namespace Derived { public class ClassA : Domain.ClassA { public overrid...

Best way to unserialize within an array

I have an array which contains serialized data similar to the example below. Array ( [0] => Array ( [id] => 4 [data] => a:2:{s:6:"Series";a:1:{s:11:"description";s:11:"hello world";}s:4:"Type";a:1:{i:0;s:1:"1";}} [created] => 2009-10-12 18:45:35 ) [1] => Array ( ...

Axis2: extract explicit XML from strongly-typed response classes?

I have a legacy Java webservice based on Axis2. This webservice classes consist of: a service interface (generated from WSDL); an implementation of the service (written in-house); a bunch of autogenerated entity-like classes representing requests and responses. I also have a requirement to extract and cache part of one of the respons...

xmlNode to objects

Hi, I have been working with a 3rd party java based REST webservice, that returns an array of xmlNodes. The xmlNode[] respresent an object and I am trying to work out the best way to Deserialize the xmlNode[] in the object? is it to build up a xmlDocument first and the Deserialize ? Thanks ...

I have some performance related questions about Silverlight Enterprise app development.

I have some performance related questions about SL Enterprise app development. -We have 10.000 rows binding to an ItemsSource control. (A total of 100.000+ UIElements when databound) Q1.How to do this binding in another thread? Because Silverlight gets stuck while the binding happens. Q2.Any other ways to do this that you suggest wit...

Using StringWriter for XML Serialization

I'm currently searching for an easy way to serialize objects (in C# 3). I googled some examples and came up with something like: MemoryStream memoryStream = new MemoryStream ( ); XmlSerializer xs = new XmlSerializer ( typeof ( MyObject) ); XmlTextWriter xmlTextWriter = new XmlTextWriter ( memoryStream, Encoding.UTF8 ); xs.Serialize ( x...

Xmlserializer not serializing base class members

I'm having this very odd issue while trying to serialize a class for logging using XmlSerializer. The code was generated by the wsdl.exe tool. The class that gets serialized as is declared as follows: [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.SerializableAttribute()] [System.Diagnostics.Debugger...

Serialization of a derived class that hides a base property

I have a class like this MyClass : BaseClass string new FirstName When I try to serialize this class I get the following error message Member SQLClientAdapter.Columns of type hides base class member Adapter.Columns of type ...Use XmlElementAttribute or XmlAttributeAttribute to specify a new name. The recomendation did not work. ...

C# Partial deserialization

So I have an xml that has a similar structure to this: <MyObject> <PropertyA>Value</PropertyA> <PropertyB>Value</PropertyB> <PropertyC>Value</PropertyC> <ArrayOfOtherObject> <OtherObject> <PropertyX>Value</PropertyX> <PropertyY>Value</PropertyY> <PropertyZ>Value</PropertyZ> ...

Why can't a dictionary object be XmlSerialized in C#?

It seems that serialization is very straightforward. Assuming that both the key and value are serializable, what could be simpler than representing key-value pairs in XML?! To all the commenters: First of all, I appreciate your answers, But- I am less interested in workoraunds (There is indeed plenty of SerializableDictionary implementa...

Analysing an XML serialized object graph to find out what takes up most space

We have a some objects that are exposed by WCF services (using wsHttpBinding) and serialized into XML. Here is an extract of one of them: [DataContract] public class Person { [DataMember] private string _forename; [DataMember] private string _middleInitial; [DataMember] private string _surname; [DataMember] private List...