I have a custom Fraction class, which I'm using throughout my whole project. It's simple, it consists of a single constructor, accepts two ints and stores them. I'd like to use the DataContractSerializer to serialize my objects used in my project, some of which include Fractions as fields. Ideally, I'd like to be able to serialize such o...
Good morning,
I am writing a C# application that needs to read about 130,000 (String, Int32) pairs at startup to a Dictionary. The pairs are stored in a .txt file, and are thus easily modifiable by anyone, which is something dangerous in the context. I would like to ask if there is a way to save this dictionary so that the information c...
As MSDN states here, it can.
But I've spent 2 hours digging mscorlib code, because in some cases the BinaryFormatter called my method marked with OnDeserialized BEFORE deserialization constructor. That is, the order was
OnDeserializing(StreamingContext context)
OnDeserialized(StreamingContext context)
.ctor(SerializationInfo info, Stre...
I use KiokuDB to store a couple of Moose objects and a couple of simple array structures (hashes and arrays).
I do not need any fancy searches, transactions etc., simple the ability to fetch (lookup) an object. Also, as soon as I'm done creating the DB, it can be set read-only. No changes will ever be made to it.
The main (only?) reaso...
I am experiencing issues with a WCF REST service. The wire object that I try to return has certain properties not set, resulting in DateTime.MinValue for properties of type DateTime. The service returns an empty document (with HTTP status 200 ???). When I try to call JSON serialization myself, the exception that is thrown is:
Seriali...
Hi all,
I have the following XSD which is generated to a class.
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" id="sales" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="sales">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="sale">...
When you have an object that provides events and you use a deepclone (serialisation) approach to cloning the object, how do you do it when there are events on the object that are actually attached.
If my object declares an event, but nothing is attached then object can be cloned without issue.
BUT if the object has had events attached,...
When I serialize the abstract class does the inheriting subclasses will also be serialize?
Does this include the members of abstract class and its subclasses?
public abstract class RootClass implements Serializable{
Object data;
}
public class SubClassA extends RootClass{
Object dataA;
}
public class SubClassB extends RootClass{
Ob...
I have a few Moose objects and some other simple hash objects (hashes, arrays) I'd like to serialize.
At first, I used a simple
my $obj_store_file = nstore($obj);
and
my $obj = retrieve($obj_store_file);
This worked well.
Later, I found about MooseX::Storage and KiokuDB. I tried using them to enjoy some benefits they have, but:
...
Does anyone have an implementation for object serialization that support collections, such as ICollection, IEnumerable, IList, IDictionary?
Below is my implementation, and it’s not so clean.
[Serializable]
public abstract class IXmlable
{
public virtual string ToXml()
{
Type type = GetType();
PropertyInfo[] pro...
Performance wise, why and how Datacontract serializer is better than xmlserializer ?
...
I was trying to serialize some (Moose) objects with YAML -- simply by using YAML's Dump() and Load(). After loading a serialized object, it didn't 'work' until I added a use statement with the original module name. If I don't use use I won't get any error until I try to invoke some object method, then it will croak saying it can't find ...
I know how to serialize in F# using mutable objects, but is there a way to serialize/deserialize using record types using either XmlSerializer or the DataContractSerializer? looks like there is a way to do this for a discriminated union using the KnownType attribute, but i am looking for a way to use non-mutable records without default c...
I have a file named config.json. Here's its contents:
{
dataSources:
[
"http://www.blahblah.com/blah",
"http://www.blahblah.com/blah2",
...
],
skills:
[
{
"name": "foobaris",
"regex": "pattern"
},
...
]
}
I want to create a Config object o...
I am trying to serialize an object that contains an EventArgs object. If I ignore the EventArgs object upon serialization, everything works fine, but if I don't put an [XmlIgnore] above it, the application crashes with the error message
System.InvalidOperationException was unhandled
Message=There was an error generating the XML docume...
In my music/rhythm game, I using serialization in order to save user-created simfiles (think music tabs or notecharts). Nothing too earth-shattering there. But, I'm using a DataContract in order to perform the serialization, because:
1) I need private and protected fields serialized as well. I don't care if they're visible, mainly due t...
I have used XML in the past, but it is very verbose and clunky. We are currently using YAML, but I am finding that most developers have alot of trouble with the whitespace. Is there a YAML like format that is whitespace insensitive, but not as verbose as XML?
...
I've written a small framework. Then I've written a new WinForms control, which hosts my one framework, and a designer.
Now my problem: The host control has a property of a class type.
Whatever I try: The property is lost at runtime.
Could someone explain me, what attributes I need?
...
Hello!
So, I am using the HtmlAgility pack (http://htmlagilitypack.codeplex.com/) to parse a script node and then I use regular expressions to parse out an object definition.
The string I end up with is plain javascript that defines an object.
Here is the sample Javascript I am trying to parse:
<!--Module 328 Buying Options Table-->
<...
Hi,
I have a complex structure in a C program which has many members that are dynamically allocated memory. How do I write this structure to a text / binary file? How will I be able to recreate the entire structure from the data read from the file.
struct parseinfo{
int varcount;
int termcount;
char **variables;
char **terminals;
...