serialization

In ADO.NET, is a DataTable or a DataReader better to serialize?

I have static data in a single table which I must serialize. I have often read that a DataReader is more performant, if you wish to have read-only data that you traverse only once. If you wish to serialize this information however, would a DataTable be better? ...

Windows Phone 7 App Quits when I attempt to deserialize JSON

I'm developing my first windows phone 7 app, and I've hit a snag. basically it's just reading a json string of events and binding that to a list (using the list app starting point) public void Load() { // form the URI UriBuilder uri = new UriBuilder("http://mysite.com/events.json"); WebClient proxy = new WebClient(); ...

Getting extended LINQ class property to serialize

I have a LINQ to SQL class (dbml) representing some tables in a database. I have added a "calculated field" of sorts by extending the partial class of one of the tables (Dwelling) with a new property (DwellingCode); this property takes the values of several database fields in the Dwelling table and generates a string. So far, everythin...

Serialize double and float with C

How can I serialize doubles and floats in C? I have the following code for serializing shorts, ints, and chars. unsigned char * serialize_char(unsigned char *buffer, char value) { buffer[0] = value; return buffer + 1; } unsigned char * serialize_int(unsigned char *buffer, int value) { buffer[0] = value >> 24; buffer[1]...

How to turn a html form into a complex JavaScript object

Is there a way to turn a form into a complex JavaScript object based some structured form? Now, I have no idea if this should be done in a better way, but basically I want something like this: <form> <input name="Foo" value="1" /> <input name="Parent.Child1" value="1" /> <input name="Parent.Child2" value="2" /> </form> and I...

Junit test of the same object

Hi i want to make a unit test suite on same object with same variable but different values But if the object get the same name (created by this.setName("testlaunch"); (who must have the name of a function launch by junit), it makes only one test. if i don't write this.setName("testlaunch"); he shout on me an [code]junit.framework.Assert...

How to deserialize object derived from Exception class using Json.net (C#)?

I'm trying to deserialize object derived from Exception class: [Serializable] public class Error : Exception, ISerializable { public string ErrorMessage { get; set; } public Error() { } } Error error = JsonConvert.DeserializeObject< Error >("json error obj string"); It gives me error: ISerializable type 'type'...

Invalid Json Primitives

Hi Could you help me for resolving this issue. I have one asp.net application, in this i am using Javascript serializer for serializing a dataset followed by convertion to the list. That code is shown below. JavaScriptSerializer json = new JavaScriptSerializer(); strJson = json.Serialize(aclDoc); But, at the time of deserializ...

Enum value not serializing correctly when converting a Generic.List(Of CustomClass) to XML

I have a Generic.List(Of ImportedVehicle) - ImportedVehicle being a simple class as below. There is an enum property which is marked as public. When I serialize to XML using an XMLSerializer, the enum's value is just set to it's default value (which is NotAllocated) and doesn't actually represent the value that is set in code. Any ide...

How do I use DataContractSerializer to create nodes/elements for a containing XML file?

Say I am persisting some application data to a single XML file and I want to use the DataContractSerializer to create all or most of the elements. So my file might look like: <?xml version="1.0" encoding="utf-8"?> <Settings> <A ... /> <B ... /> </Settings> (A and B are serialized using DCS.) How would I go about writing this fil...

Passing serialized object through web service vs. Passing the object

I have a webservice in C#.NET with the following namespace: [WebService (Namespace = "http://enterpriseName/wsName")] The web service contains a WebMethod GetServiceObject and a class MyObject. This web method returns a string whose content is a serialized instance of MyObject. [WebMethod (MessageName = "GetServiceObjectXML" Descript...

Is there a shortcut to binary-serialize every property in an object?

Hi, If there is an object in which every public property must be serialized and properties are simple (just numbers or strings or objects already implementing ISerializable), is there an easy way to do it without having to create GetObjectData(SerializationInfo info, StreamingContext context) and a constructor taking SerializationInfo a...

How to serialize and deserialize a form?

How do I serialize and deserialize my main form (and its controls, subcontrols, their values, etc.)? Edit, for clarification. Currently I am writing the current value of each control to an .INI file, one by one and reading it back when the program is next run. Every time I add a new control, I have to remember to update that save/load...

XmlSerializer.Deserialize - ignore unnecessary elements?

Hi, I've got an XSD schema which I've generated a class for using xsd.exe, and I'm trying to use XmlSerializer.Deserialize to create an instance of that class from an XML file that is supposed to conform to the XSD schema. Unfortunately the XML file has some extra elements that the schema is not expecting, which causes a System.InvalidOp...

Hard to decide between XML serialization options available in .NET

Until last night, I've been parsing XML using a variety of libraries in .NET -- XmlDocument and XDocument mostly. I'm not sure why I didn't look into this sooner, but it occurred to me that there must be something available in .NET that gives you class serialization / deserialization for free, and of course that comes in the form of the...

Mappings between Data Models in n-Tier Systems !

Greetings Overflowers, I'm really tiered of over-thinking this subject Here are typical mappings: Relation DB Model <> Server OO Model <> Serialized Model <> Client OO Model <> stands for bi-directional mapping I'm currently using Java for my backend and ExtJS (JavaScript library) for my frontend. It makes sense to serialize to/from...

Serialization of class derived from List<> using DataContract

I'm trying to serialize a class derived from List<> using DataContract. The problem is that properties of my class won't get serialized. My classes: [CollectionDataContract] /*[Serializable]*/ /*[DataContract]*/ public class DownloadRuleCollection : List<DownloadRule> { [DataMember(EmitDefaultValue = false)] public string Some...

Is NSMutableArray writeToFile recursive?

Does NSMutableArray support recursive serialization? E.g. will a NSMutableArray of NSMutableArray's serialize the entirety of the heirarchy out when calling writeToFile? Example: NSMutableArray *topArray = [[NSMutableArray alloc] init]; NSMutableArray *bottomArray = [[NSMutableArray alloc] init]; NSString *foo = @"foo"; NSString *bar...

Deserializing into Object when class is in default package on android

I have an application that queries a server (not under my control). The server returns a serialized object. I have the model for the class - however the problem is that the class is in "default package"... something not recognizable by Android ClassLoader. How can I resolve this issue? ...

XML Serialization with .NET

Hello, I'm tryng to serialize an object to XML by using C# with the following code: memoryStream = new System.IO.MemoryStream(); Serializer.Serialize(memoryStream, this); memoryStream.Seek(0, System.IO.SeekOrigin.Begin); streamReader = new System.IO.StreamReader(memoryStream); ...