I'm trying to unit test saving of a file. I have an interface that defines a document, and I pass a concrete object that implements that interface to the Save method, and it works in practice, but I'm trying to unit test it to ensure that it will always work (and I'm desperately trying to catch up on the unit tests after a period of 'cru...
I have a convenience collection class in my Flex project called HashMap, which is essentially a wrapper around the flash.utils.Dictionary with a bunch of convenience methods and an added (synced) ArrayCollection so that I can pass the HashMap to bindable controls that want an ArrayCollection. That all works fine.
What doesn't work fine,...
Recieved the following exception when deserializing a HashMap<String, Integer>:
java.io.InvalidClassException: java.lang.Integer; local class incompatible: stream classdesc serialVersionUID = 1360826667802527544, local class serialVersionUID = 1360826667806852920
Serialized and deserialized on the same machine, with the same JRE. JDK 1...
I think I've come across this requirement for a dozen times. But I could never find a satisfying solution. For instance, there are a collection of string which I want to serialize (to disk or through network) through a channel where only plain string is allowed.
I almost always end up using "split" and "join" with ridiculous separator li...
I'm exposing some resources via a simple API that returns JSON. I would like to inject the path to each of the resources so that the consumer need not construct them. Example of desired output for something like User.all.to_json:
users: [
{user: {
id: 1,
name: 'Zaphod',
url: 'http://domain.com/users/1.json'
}},
{user...
I am serializing to a json object using:
public static string ToJson(this object obj)
{
JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
return jsonSerializer.Serialize(obj);
}
However when I'm populating a hidden field, I'm getting the slashes with it:
"[{\"ImageLink\":\"\",\"ShowOnHomePage\":null,\"Type\...
I want to save my program's DataModel objects to a file, and be able to reload the same object graph again. I want it to be in some flavor of text file, so I can diff it and open it in a text editor. XML would be fine, and seems like a good place to start since .NET has XML serialization built in.
But which flavor of XML serialization s...
I was reading Microsoft's Best Practices: Data Contract Versioning, and they state:
Do not remove data members in later versions, even if the IsRequired property was left at its default property of false in prior versions.
Can anyone suggest any reason for this? They don't elaborate. Since they say it's fine to add data members in ...
I wrote a routine to remove pounds and ids from sharepoint fields that worked flawlessy, since I found a field withouth ids and # (pound) signs.
I want to understand why sometimes the field is serialized with ids and pounds and sometimes not.
example:
ows_Author="23;#Paperino, Pippo"
or
ows_Author="Paperino, Pippo"
...
Is it possible to pass generic objects (by generic I mean any with DataContract, not C# generic collection) without inheriting from one root? At the moment I have something like this:
[OperationContract]
void Save(GenericObject o);
[DataContract]
[KnownType(typeof(ClassA))]
[KnownType(typeof(ClassB))]
class GenericObject {....
[DataCo...
We are migrating from Remoting to WCF a very big application that makes intensive use of DataSets. We use the ExtendedProperties of the DataSets' tables to store a graph of objects containing special information we need at client side.
In our Remoting implementation we did add to the channel stack a client and a server channels to check...
I have a PHP frontend and a C++ backend, and I need to be able to send groups of names to the frontend. What serialized format would be the most efficient/fastest for the PHP to read?
Example data
group1:
name1 3923
name2 9879
name3 8944
group2:
name5 9823
group3:
name9 9822
name1 4894
What would be the fastest for PHP ...
I am trying to save a List<Foo> using ApplicationSettingsBase, however it only outputs the following even though the list is populated:
<setting name="Foobar" serializeAs="Xml">
<value />
</setting>
Foo is defined as follows:
[Serializable()]
public class Foo
{
public String Name;
public Keys Key1;
public Keys Key2;
...
Hi,
I have class A, which exposes an event. an object of class B subscribed to the event.
Both instances actually also hold a regular reference to eachother.
I'd like to serialize A, and have both objects be transferred over the wire, to be reconstructed at the other end. This works fine, except that the event subscription is not retai...
Can I make XmlSerializer ignore the namespace (xmlns attribute) on deserialization so that it doesn't matter if the attribute is added or not or even if the attribute is bogus? I know that the source will always be trusted so I don't care about the xmlns attribute.
...
I have some (small amount) of data that I'll need quick access to on inital load, but not after that.
Right now, I have serialized the data (Generic List) to an Xml file and I'm deserializing it on load as needed.
My question is should I use the XmlSerializer or the BinaryFormatter? I'm not worried about file size, but serialization sp...
I have a dictionary of objects; they are all POCO objects that should be serializable. What technique should I look at for writing these to disk. I'm looking for the simplest option to write a few lists to save state.
I think I have 3 options.
plist files. However this seems to be limited to only storing predefined objects (strings...
Hi
I've been reading lately about serialization. I've read that when I use XmlSerialization I cannot serialize object graphs. What is an object graph and why I cannot serialize it simply?
Kind Regards
PK
...
Hi,
If a similar question is already posted on stackoverflow, pls just post the link.
What is the need to implement Serializable interface (with no methods) for objects which are to be serialized ?
The Java API says -
- If its not implemented then it will throw java.io.NotSerializableException.
That's because of the following code in ...
Question
What is (if there is any) terminating characters/byte sequences in serialized java objects?
Background
I'm working on a small self-education project where I would like to serialize java objects and write them to a stream where there are read and then unserialized. Since, I will need to identify the borders between serialized ...