.NET Framework class, Serializing and deserializing an instance of a type into an XML stream or document using a supplied data contract.
Questions tagged [datacontractserializer]
900 questions
0
votes
1 answer
BOM encoding for database storage
I'm using the following code to serialise an object:
public static string Serialise(IMessageSerializer messageSerializer, DelayMessage message)
{
using (var stream = new MemoryStream())
{
messageSerializer.Serialize(new[] { message…

Neil Barnwell
- 41,080
- 29
- 148
- 220
0
votes
2 answers
DataContract deserializer with Dictionary
If i have an xml like:
aaaa
bbb
ccc
Can I deserialize it into a Foo class with a dictionary structure and a string property like following using the same DataContract Deserializer? With A and B…

NewDTinStackoverflow
- 543
- 1
- 7
- 18
0
votes
0 answers
Token EndElement in state EndRootElement would result in an invalid XML document
I am developing an application for wp7.i am storing the state of my application in isolatedstoragefile using datacontractserializer.Now when i try to serialize the object
sometimes i face this exception.
Token EndElement in state EndRootElement…

rakesh
- 602
- 1
- 5
- 23
0
votes
1 answer
JSON returning null values using WCF Services
Hi all I am new in JSON and WCF Services. I am trying to call wcf service using JSON and my paramater is one of my data contract class.
Here is my Data Contract Class.
namespace Employee.Services.DataContracts
{
using System;
using…

user968441
- 1,471
- 9
- 22
- 48
0
votes
1 answer
DataContractSerialization and the new keyword inheritance
I have an issue where a XML element "Event" is being serialized twice because of the new keyword. I want the derived type to only be serialized.
[DataContract(Name = "Division", Namespace = "")]
public class ApiTeamDivision : ApiDivision
{
…

Mike Flynn
- 22,342
- 54
- 182
- 341
0
votes
2 answers
Deserializing XML to class when the property name is an attribute on each node
I'm attempting to integrate with a 3rd party REST API. This API always returns all of it's resources as type Asset and it's properties as type Attribute. It uses an attribute on the Attribute nodes to supply the property name. The xml reads as…

Daniel Revell
- 8,338
- 14
- 57
- 95
0
votes
1 answer
Entities are not serializing using DataContractSerializer
I am trying to serialize Entities in my project. I have a lot of them so i'm starting with just one at the moment. The goal of my project is to create an audit trail with entity framework. When I break at audit.newvalue = doc.root.tostring() the…

Michael
- 1,022
- 1
- 11
- 28
0
votes
2 answers
DataContractSerializer outputting XML with "field" appended to all elements and out of order
I'm new to creating WCF REST services - so please let me kwow if I'm doing things wrong here.
I have a REST-based service developed using WCF, with the following DataContract defined:
namespace Messaging
{
[DataContract(Name = "Email",…
Sean
0
votes
2 answers
DataContractSerializer - Ignore nulls in an array
I have an array of Objects, which may contain null values.
When serializing the array, I am also getting an empty tag to represent the null value. Ex.
How can I…

Rajan Panneer Selvam
- 1,279
- 10
- 24
0
votes
1 answer
How to deserialize JsonResult with DataContractJsonSerializer
i have an MVC Controller that returns:
public JsonResult ValidateUser(string siteId, string userName, string password)
{
UserObj userObj = new UserObj();
userObj.Name = userName;
return…

VAAA
- 14,531
- 28
- 130
- 253
0
votes
1 answer
Mark Event as NonSerializable for DataContractSerializer
I have the following Event in my implementation of RelayCommand:
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
Now I'm using…

M.E.
- 2,759
- 3
- 24
- 33
0
votes
1 answer
Data serialization on WIndows Phone
I'm following this tutorial and I'm stuck at the part where the TwitterAcces class (that contains the twitter token) is serialized. This is where the serialization method is called:
void CallBackVerifiedResponse(OAuthAccessToken at,…
user393964
0
votes
1 answer
Serializing/Deserializing a List of DataContracts
Is there anyway to serialize a List of datacontracts? I have created a datacontract for the list, something like this:
[DataContract]
class ItemList
{
public ItemList()
{
items=new List();
}
[DataMember]
public…

Notbad
- 5,936
- 12
- 54
- 100
0
votes
2 answers
deserialize json
I am trying to call a web-service from an aspx page. The web-service returns json. I need to deserialize the json objects.
I tried to extract the string, it is of the form :
"{ \" d \" : [ { \" _type \" : \" Myclass:#serviceName \", ....other…

Dipit Grover
- 1
- 2
0
votes
1 answer
Is there a reason for the nested generic collection classes in svcutil generated code?
I'm generating my data contract with a command line like:
svcutil /ct:System.Collections.Generic.List`1 MySchema.xsd
In my generated code, I end up with something like this (let's call this "style 1"):
partial class A : object,…

Colin Young
- 3,018
- 1
- 22
- 46