Hi,
I have my own data structure written in C# (the structure is quite complex). I need to serialize and deserialize the structure. The size of the serialized file in disk can be pretty large at times (close to a 1 GB) but it can be small also (based on the number of records stored). I have the following requirements:
The serializatio...
In .NET 2.0 (and upwards, I presume), Version Tolerant Serialization will succesfully deserialize a serialized object from an older version of the assembly in which the object resides.
When I open such a binary formatted serialized stream using a hex viewer (a simple drag'ndrop into VS will do) I can see there's assembly information con...
I have the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication28
{
class Program
{
static void Main()
{
List<string> dirs = FileHelper.GetFilesRecursive(@"c:\Documents and Settings\bob.smith\Desktop\Test");
foreach...
Is it possible to exclude specified fields at runtime when serializing an object to a JSON string? i.e. When serializing an object, only serialize fields specified in list.
...
Hi,
it looks like that I am not able to expose via COM a class to an unmanaged client if one of the property of the class has type DateTime .
Example:
[ComVisible(true)]
public interface ITest
{
string Name { get; }
DateTime Date { get; }
}
[Serializable]
[ComVisible(true)]
public class Test : ITest
{
public string Name { g...
I need to be able to Xml Serialize a class which is internal, so I must implement IXmlSerializable.
This class has a two strings and a List in it.
I know to read and write the strings using WriteElementString & ReadElementContentAsString.
However, I'm lost on how to read & write the List in the ReadXml & WriteXml methods.
How do I do...
I'm using Python (Python 2.5.2 on Ubuntu 8.10) to parse JSON from (ASCII encoded) text files. When loading these files with json (simplejson), all my string values are cast to Unicode objects instead of string objects.
The problem is, I have to use the data with some libraries that only accept string objects.
Is it possible to get stri...
Does anyone have any examples of how to encrypt serialized data to a file and then read it back using DES?
I've written some code already that isn't working, but I'd rather see a fresh attempt instead of pursuing my code.
EDIT: Sorry, forgot to mention I need an example using XmlSerializer.Serialize/Deserialize.
...
I'm creating a web service in WCF that returns JSON, but the DataContractJsonSerializer is balking on some circular references (which I can't remove in this particular case).
Instead, I'd like to use the Newtonsoft json library. What's the easiest way to create a custom serializer in WCF?
Note: I know I could just return a stream, bu...
I'm trying to create a piece of xml. I've created the dataclasses with xsd.exe.
The root class is MESSAGE.
So after creating a MESSAGE and filling all its properties, I serialize it like this:
serializer = new XmlSerializer(typeof(Xsd.MESSAGE));
StringWriter sw = new StringWriter();
serializer.Serialize(sw, response);
string xml = sw.T...
using System;
using System.Collections.Generic;
using System.IO;
class Program
{
static void Main()
{
// Get all files in Documents
List<string> dirs = FileHelper.GetFilesRecursive("S:\\bob.smith\\");
foreach (string p in dirs)
{
Console.WriteLine(p);
}
// Write count
...
I've got a little struct that I want to serialize in my ViewState. It looks something like this:
[Serializable]
private struct DayMoney
{
public readonly DateTime ValidFrom;
public readonly string CurrencyCode;
public readonly double Amount;
}
It serializes just fine, but when I perform a postback/callback, I get an except...
How to save c++ object into a xml file and restore back?
...
Is public declaration a requirement for a class to be serializable? I've been going through some code where all classes marked as [Serializable] were also declared public. I could not find formal documentation stating this.
...
Is is possible to only deserialize a limited number of items from a serialized array?
Background:
I have a stream that holds a serialized array of type T. The array can have millions of items but i want to create a preview of the content and only retrieve the, say, first one hundred items. My first idea was to create a wrapper around ...
I am having a look into using the DataContractSerializer and I'm having trouble getting the right output format. The DataContractSerializer serializes the following class
[DataContract(Name = "response")]
public class MyCollection<T>
{
[DataMember]
public List<T> entry { get; set; }
[DataMember]
public int index { get; ...
Is there a way to efficiently share or move .NET objects across AppDomains? I realize that the intent of AppDomains is to provide isolation - however I have a case where I need to move a relatively large, cached set of immutable objects that are expensive to compute and create. At the moment, I have a serialization approach that works, b...
I'm building a game in XNA 3 and I have the levels stored in XML format. What solution would you recommend for deserializing those XML files into level objects? it needs to be able to work on the Xbox.
...
I'm not looking for a comparison of two structs that returns bool, I am wondering if there is a way to get which fields of two structs (the same structure, but maybe different values) are different. Basically I want a simpler way to do the following:
public class Diff
{
public String VarName;
public objec...
How to determine a proper serial version ID? Should it be any big long value using some generators or any integer wld suffice ?
...