serialization

Deserialize flat xml to entities

Hello, Have the following XML model <A></A> <B></B> <C></C> <D></D> Also have three classes class Foo1{ public string A; public string B; } class Foo2{ public string C; public string D; } class FooUnited{ public Foo1 foo1; public Foo2 foo2; } The problem. I want to deserialize xml into object of FooUnited type. The br...

Deserializing json array into .net class

I'm having problems deserializing some json data, getting InvalidCastExceptions and the like. Can anyone point me in the right direction? Here's the json i'm wanting to deserialize; [{"OrderId":0,"Name":"Summary","MaxLen":"200"},{"OrderId":1,"Name":"Details","MaxLen":"0"}] Here's my code; Public Class jsTextArea Public O...

Can I extend Serializable interface?

I could try an interface extending Serializable interface, So can we do that? if yes then will that extended interface will take the same effect as the Serilizable interface? If not Why? ...

Java XML Serializing, Missing fields in file

Hi there this is the issue at hand, when trying to serialize the class below with the code below i'm getting is the below xml file without all the strings in the class. The Class (some static values have changed but basically it), I left out all the generated get\set but they are all there with public access modifiers. public class Not...

How do I create a shallow copy of an object so that it may be serialize and sent via a web method call?

I would like to serialize the properties of the HttpBrowserCapibilities object so that it may be returned via a web method call. Currently the object cannot be serialized: Cannot serialize member System.Web.Configuration.HttpCapabilitiesBase.Capabilities of type System.Collections.IDictionary, because it implements IDictionary. ...w...

Trying to serialize a Datacontract that contains a list of other Datacontracts C#

The problem is that I' not getting the structure of XML that I want. My Code is as follows: [DataContract] public class Persons { [DataMember] public List<Person> Personas; } [DataContract] public class Person { [DataMember(Name="SSN")] public long SSN { get; set; } [DataMember(Name="Name")] ...

protobuf-net [de]serializing across assembly boundaries

I have a base class in one assembly and a large number of generated classes in another that inherit from the base class. Using protobuf-net (r282) to serialize a list of the base type fails when attempting to resolve the subclassType (line 248 of SerializerT.cs) because the subclass is not in the assembly of the base class. Moving the cl...

Unit Test Adapter threw exception: ... is not marked as serializable..

this error is driving me nuts: Unit Test Adapter threw exception: Type 'com.imagehawk.ZDRCreator.Config.ZDRCreatorConfigException' in assembly 'ZDRCreator, Version=1.0.5.1, Culture=neutral, PublicKeyToken=null' is not marked as serializable.. it's an exception, the only places it's used is like this throw new ZDRCreatorConfigException(...

Deseralizing XML into simple .NET class, cannot populate property from root node attribute.

I have a simple class that I trying to populate from an XML document. The XML file has an attribute called TrackingID in the root node which I would like to get as a property. For some reason, when I deseralize the class, the TrackingID is null. Everything else populates fine. I have tried various attributes on the TrackingID property ...

Applying SoapIgnore attribute doesn't take any effect to serialization result

I'm trying to figure out .NET serialization stuff and experiencing a problem. I've made a simple program to test it and got stuck with using attributes. Here's the code: [Serializable] public class SampleClass { [SoapIgnore] public Guid InstanceId { get; set; } } class Program { static void Main() ...

Json Deserialization to Dictionary .NET

Given json like this: [["Rating (out of 5)","3"],["Date taken","Mon, 03 Mar 2003 03:04:03 GMT"]] What is the best way to deserialize it into something like Dictionary<string, string> or should I be using a different data structure? I'd probably prefer to use the .net Serializer but will consider other options if this wont work. ...

Silverlight passing JSON object incorrectly?

I have a Silverlight class marked with the ScriptableType & ScriptableMember and I expect to be able to pass the object from Silverlight to javascript. When I call JSON.stringify (in javascript) I expect to receive a JSON representation of the object but all I get is {} The class is defined as: [ScriptableType()] public class MyEvent {...

.NET IpcChannel doesn't reliably clean up properly?

For some reason, after using an IpcChannel and shutting it down, sometimes the namedpipe stays open, with a thread waiting on it. I cannot make this happen on demand in a debug environment, but it happens 5 to 10 times per day in our production environment. The bad effect this is having is that it is stopping me from unloading the appd...

XmlSerializer to Deserialize and return the first row

Hi I have a xml that look like: . . I post the code: public interface ImmoListItem { LISTRow[] items { get; set; } } public partial class XMLImmo : ImmoListItem { private LIST LISTdata; public XMLImmo(string query) { StringReader reader = new StringReader(query); ...

Generic WCF JSON Deserialization

I am a bit new to WCF and will try to clearly describe what I am trying to do. I have a WCF webservice that uses JSON requests. I am doing fine sending/receiving JSON for the most part. For example, the following code works well and as expected. JSON sent: { "guy": {"FirstName":"Dave"} } WCF: [DataContract] public class S...

Robust+easy way to save/restore Android app instance state

In Android, you need to implement the following Activity methods so your application can be restored to its previous state if the OS decides to destroy then recreate your activity: public void onSaveInstanceState(Bundle savedInstanceState) public void onRestoreInstanceState(Bundle savedInstanceState) The examples I've seen of implemen...

Cocoa: Element count of property list without building dictionary?

What is the best way to count the number of entries in a property list? I currently build a dictionary from the plist entries (*) and then use the dictionary's count: NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:myPlistPath]; NSDictionary *myPlistDict = (NSDictionary *) [NSPropertyListSerialization ...

Serialize/Save control property(ex:TextBox.Text) to a custom config file

Hello, I'm working on a small program and I would like to save some control states and properties into a configuration file. However I don't want to use the "traditional" settings file due to several reasons, but rather have it serialized or simply saved into a specific file. For example get window1's TextBox1.Text and serialize it, so...

mmap-loadable data structure library for C++ (or C)

I have a some large data structure (N > 10,000) that usually only needs to be created once (at runtime), and can be reused many times afterwards, but it needs to be loaded very quickly. (It is used for user input processing on iPhoneOS.) mmap-ing a file seems to be the best choice. Are there any data structure libraries for C++ (or C)?...

How can I serialize and communicate ActiveRecord instances across identical Rails apps?

The main idea is that I have several worker instances of a Rails app, and then a main aggregate I want to do something like this with the following pseudo pseudo-code posts = Post.all.to_json( :include => { :comments => { :include => :blah } }) # send data to another, identical, exactly the same Rails app # ... # Fast forward to the s...