My "Location" object isnt getting serialized in my WCF datacontract, however, all other variables are being set properly. When I try to output a variable in the location object I get the "Object reference not set to an instance of an object" error
My DataContract:
[DataContract(Namespace = "")]
public class CalcRequest : BaseRequest
{
...
I just wrote this SerializationHelper class, but I can't believe this is necessary!
using System.IO;
using System.Xml.Serialization;
public static class SerializationHelper
{
public static string Serialize<T>(T obj)
{
var outStream = new StringWriter();
var ser = new XmlSerializer(typeof(T));
ser.Seria...
I have a question about binary serialization in C#
I need to be able to deep clone objects of class B (along with all it's subobjects in the graph of course). I'd like to implement this by using binary serialization. The discussion if that's the best method is irrelevant in the context of this question.
Say I have this class structure:...
My problem resembles this question but is not exactly the same: http://stackoverflow.com/questions/1460063/change-culture-when-deserializing-wcf-service
I have built a WCF (web) service running on Windows 7 (IIS 7.5) using VS 2008. One of the properties in my webservice is typed as a System.Double. When building my own client for testin...
I have a java server that has to communicate over a TCP socket to an external program written in C. They pass messages back and forth in a message protocol that can't be changed (due to reasons too complicated to go into here).
The TCP messaging protocol looks roughly like this:
Header (with message length) -> Message body -> Message C...
I need to serialize and unserialize (is that even a word?) an array in AS3, so it can be sent as a string.
The only problem is that it doesnt just contain text, it contains objects.
Is it possible to serialize and unserialize arrays in AS3 like you can in PHP? How can I do so?
Once this bug is fixed, all will be well with my program.
...
I extracted the following node from XmlReader:
string xml = "<FeatureType xmlns=\"http://www.opengis.net/wfs\" > </FeatureType>"
In order to deserialize to a predefined class, I attempted:
using (StringReader elementReader = new StringReader("<?xml version='1.0'?>" + xml ))
{
// TODO: Can data contract serializer be used?
Xml...
In the example code below, I get this error:
Element
TestSerializeDictionary123.Customer.CustomProperties
vom Typ
System.Collections.Generic.Dictionary`2[[System.String,
mscorlib, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089],[System.Object,
mscorlib, Version=2.0.0.0,
Culture=neutral,
PublicKeyT...
Given this code
public override void Serialize(BaseContentObject obj)
{
string file = ObjectDataStoreFolder + obj.Slug + ".xml";
if(obj.GetType() == typeof(Page))
{
DataContractSerializer dcs = new DataContractSerializer(typeof (Page));
XmlDictionaryWriter myWriter =
...
I'm attempting to Serialize my custom collection UserDataCollection, made out of UserData objects. I wondered when implementing Serialization, does the actual object (UserData) also need have the attribute [Serializable] and inherit from the ISerializable interface?
I want to serialize each object (UserData) in the collection, all it's...
I have this code for serializing my custom collection of UserData Objects. However the current property only represents the item currently being used in the collection, so it only serializes that one object.
I want all the objects serialized in my collection, how would I go about that in the GetObjectData implementation of my Collectio...
I have an XSD, and used the xsd.exe tool to create c# classes. In a webservice I am accepting in the MessageContract an instance of one of these created objects.
The relevant portion of the xsd to this question is here:
<xs:element name="Tasks">
<xs:complexType>
<xs:sequence>
<xs:element ref="Task" maxOccurs="un...
I have a WebService that returns complex objects.
public class Resource;
public class Asset extends Resource;
public class Collection extends Resource;
The methods that return the subclasses work fine:
Asset[] getAssets();
Collection[] getCollections();
However the methods that return the base class are generating an exception...
I have some XML that I deserialize into a business object. I am using XmlSerializer.Deserialize to do so. However, I want one of the XmlElement contained in the XML to stay an XElement.
It cannot be done directly (using an XmlElementAttribute) since XElement is not Serializable. I also tried to serialize that element to a string (in ...
I keep getting a 'Type XXX is not marked as serializable' exception when I try to serialize an object of mine. It might sound silly, but my problem is that I can't seem to find any references to an object of type XXX anywhere on the object graph (using the debugger hover windows). Does anyone know a good way to scan the object graph fo...
This is probably just a question of syntax (and my inability to find it ;)
Here's the collections to be (de)serialized:
private Map<String, Terminal> terminals = Collections.synchronizedMap(new HashMap<String, Terminal>());
private List<Host> hosts = Collections.synchronizedList(new ArrayList<Host>());
Here goes serialization:
Objec...
Are there any stateful eventing mechanisms in .net(c#) or any libraries that will help me maintain a state for the events fired
By stateful I mean an event when fired is serialized to a persistent storage. If the system fails for some reason and then when it is bought back picks up the serialized state and then fires it again.
I am a...
I'm trying to find a way to generate Linq to SQL classes with bi-directional serialization attributes. Basically I want a DataMember tag (with an appropriate order) on every association property, not just the ones where the class is the primary key (like the Visual Studio generator and SQL Metal do). I checked MyGeneration, but didn't re...
I'm writing a app that needs to be portable. I know I should disable magic quotes on the PHP configuration but in this case I don't know if I can do that, so I'm using the following code:
if (get_magic_quotes_gpc() === 1)
{
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process))
{...
Dear folks,
I've got an objective-c/cocoa based application that I'm working on. This app is client<->server. Currently, the communcation protocol is based upon some fairly simple XML. While XML works for this task, it is not ideal in any aspect. It's a pain to serialize data to XML, it's not particularly light-weight, and difficult to i...