Is there a way in .NET 2.0 (C#) to serialize object like you do using XmlSerializer in a simple / customizable human readable format thats for instance looks like PXLS or JSON?
Also I know that XML is human readable, I'm looking for something with less annoying redundancy, something that you can output to the console as a result for the ...
I have a web-app-database 3 tier server setup. Web requests data from app, and app gets its data from the db then processes and returns it to web for display. Standard.
Currently all the data I serialize from app to web gets put into custom defined data structs that the web side then parses for display. In other words, say I have an or...
I'm curious about people's experiences using AR's to_xml() to build non-entity fields (as in, not an attribute of the model you are serializing, but perhaps, utilizing the attributes in the process) from a controller.
to_xml seems to supply a few options for doing this.
One is by passing in references to methods on the object being...
From the reading I've done I'm under the impression the DataContractSerializer handles versionong issues by, if members in the request are not there it will set the default value, and if addional members are in the request but not in the definition the serializer will simply ignores these fields and not process them.
Firstly, is this as...
I have a linq query and I am trying to put that in to a serializable object for a distributed caching (Velocity) but its failing due to a LINQ-to-SQL lazy list
like so
return from b in _datacontext.MemberBlogs
let cats = GetBlogCategories(b.MemberBlogID)
select new MemberBlogs
...
Has anyone else run into this problem before? I've got a method that calls a generic method with a delegate, inside of a generic class. I've marked the class as Serializable, and it serializes without complaint. But, when I try to deserialize an object of this class, it pegs the CPU and hangs the machine.
Code example:
public delegate ...
Is there a built-in way to know if a given session variable is a serialized object? Say I retrieve a value like $_SESSION['foo'], but I don't know if it was originally a string or if it is a serialized object. Is there some way to check, or once serialized does PHP just see a string as a string as a string?
...
I have an existing application that uses CArchive to serialize a object structure to a file. I am wondering if can replace the usage of CArchive with some custom class to write to a database the same way that things are serialized. Before I go about figuring if this is doable I was wondering if other people have done the same- what is ...
I'm passing small (2-10 KB)XML documents as input to a WCF service. now I've two option to read data values from incoming XML
Deserialize to a strongly typed object and use object properties to access values
use XPath to access values
which approach is faster? some statistics to support your answer would be great.
...
I have a class that maintans a reference to a Hashtable and serializes/deserializes that Hashtable. After the call to SerializationInfo.GetValue, the Hashtable is not fully deserialized because the deserialization happens during the IDeserialization calback.
Hashtable hashtable = (Hashtable) info.GetValue("hash", typeof(Hashtable));
I...
What is the best way to pass data between a C server to a Java applet? Currently it's done by using a buffer and copying bytes to it using memcpy, but if the object ever changes I have to hunt down every instance of where it's being sent to the applet and have it changed.
Is there a better way to pass object to java? How would you do it...
Imagine the following.
Html is parsed into a dom tree
Dom Nodes become available programmatically
Dom Nodes may-or-may-not be augmented programmatically
Augmented nodes are reserialised to html.
I have primarily a question on how one would want the "script" tag to behave.
my $tree = someparser( $source );
....
print $somenode->...
How do I serialize a 'Type'?
I want to serialize to XML an object that has a property that is a type of an object. The idea is that when it is deserialized I can create an object of that type.
public class NewObject
{
}
[XmlRoot]
public class XmlData
{
private Type t;
public Type T
{
get { return t; }
set...
Hello all, let me tell you a bit about where this question came from. I have been playing around with the SDK of Serious Sam 2, a first person shooter which runs on the Serious Engine 2. This engine introduces something called MetaData. MetaData is used in the engine to serialize classes and be able to edit them in the editor environment...
I want to save a set of email addresses collected from a text field (separated by commas) into a single field in a table. I am trying to use serialize but I'm getting SerializationTypeMismatch error. How can I do this?
This is my model:
class Crew < ActiveRecord::Base
class Recipients < HashWithIndifferentAccess ; end
serialize :reci...
I have the following class
[XmlRoot(ElementName= "webSites")] //No capital w at the beginning
public class WebSites : List<WebSite>
{
}
public class WebSite
{
[XmlAttribute("name")]
public string Name { set; get; }
[XmlAttribute("url")]
public String Url { set; get; }
}
this is serialized to
<?xml version="1.0"...
I have the following structure:
class Base
{
}
class Child : Base
{
}
When I try to do the following:
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Base));
serializer.WriteObject(stream, data);
It fails with the error message:
Type
'MyNamespace.Child'
with data contract name
'Child:http://...
Is there any way to direct C# to ignore NullReferenceException (or any specific exception for that matter) for a set of statements.
This is useful when trying to read properties from a deserialized object that may contain many null objects in it.
Having a helper method to check for null could be one way but I'm looking for something clo...
I am looking for example code that provides a unit test to serialize and deserialize an object from a memory stream. I have found examples using C# 2.0, however my current project uses VB.NET 1.1 (don't ask me why...), so the solution can not use generics. I am also using the NUnit framework for the unit tests.
Thanks!
...
Hi,
I have a simple class in my WCF service that doesn't seem to be showing up properly for the client that accesses my WCF.
My class has 4 public properties that are of type string.
I marked the class with [DataContract()] and each member with [DataMember].
Why is my constructor not visible? Is there a special [attribute] for const...