¡@

Home 

c# Programming Glossary: serializer

How to create JSON string in C#

http://stackoverflow.com/questions/1056121/how-to-create-json-string-in-c-sharp

static string ToJSON this object obj JavaScriptSerializer serializer new JavaScriptSerializer return serializer.Serialize obj public.. serializer new JavaScriptSerializer return serializer.Serialize obj public static string ToJSON this object obj int.. this object obj int recursionDepth JavaScriptSerializer serializer new JavaScriptSerializer serializer.RecursionLimit recursionDepth..

JavaScriptSerializer.Deserialize - how to change field names

http://stackoverflow.com/questions/1100191/javascriptserializer-deserialize-how-to-change-field-names

public void DataObjectSimpleParseTest JavaScriptSerializer serializer new JavaScriptSerializer DataObject dataObject serializer.Deserialize.. serializer new JavaScriptSerializer DataObject dataObject serializer.Deserialize DataObject JsonData Assert.IsNotNull dataObject.. it be done at all c# json parsing serialization javascriptserializer share improve this question I took another try at it using..

Parse JSON in C#

http://stackoverflow.com/questions/1212344/parse-json-in-c-sharp

Encoding.Unicode.GetBytes json DataContractJsonSerializer serializer new DataContractJsonSerializer obj.GetType obj T serializer.ReadObject.. new DataContractJsonSerializer obj.GetType obj T serializer.ReadObject ms Your missing line return obj Also just for reference.. static string Serialize T T obj DataContractJsonSerializer serializer new DataContractJsonSerializer obj.GetType using MemoryStream..

Generating an Xml Serialization assembly as part of my build

http://stackoverflow.com/questions/134224/generating-an-xml-serialization-assembly-as-part-of-my-build

ultimately runs without issue void ReadXml XmlSerializer serializer new XmlSerializer typeof MyClass ... Here is the exception A..

XML Serialization and Inherited Types

http://stackoverflow.com/questions/20084/xml-serialization-and-inherited-types

this creates a tight coupling between the class and the serializer not good . We can implement our own XmlSerializer by creating.. there how do we tell the XmlSerializer to work with our serializer rather than the default We must pass our type within the Xml..

Why XML-Serializable class need a parameterless constructor

http://stackoverflow.com/questions/267724/why-xml-serializable-class-need-a-parameterless-constructor

static string SerializeToXml object obj XmlSerializer serializer new XmlSerializer obj.GetType using StringWriter writer new.. obj.GetType using StringWriter writer new StringWriter serializer.Serialize writer obj return writer.ToString If the argument..

Deserialize JSON into C# dynamic object?

http://stackoverflow.com/questions/3142495/deserialize-json-into-c-sharp-dynamic-object

string object dictionary Type type JavaScriptSerializer serializer if dictionary null throw new ArgumentNullException dictionary.. string object Serialize object obj JavaScriptSerializer serializer throw new NotImplementedException public override IEnumerable.. #endregion You can use it like this string json ... var serializer new JavaScriptSerializer serializer.RegisterConverters new new..

How to Deserialize XML document

http://stackoverflow.com/questions/364253/how-to-deserialize-xml-document

~ App_Data cars.xml XmlSerializer serializer new XmlSerializer typeof Cars StreamReader reader new StreamReader.. reader new StreamReader path reader.ReadToEnd cars Cars serializer.Deserialize reader reader.Close return cars that don't seem.. CarCollection cars null string path cars.xml XmlSerializer serializer new XmlSerializer typeof CarCollection StreamReader reader new..

Performance Tests of Serializations used by WCF Bindings

http://stackoverflow.com/questions/3790728/performance-tests-of-serializations-used-by-wcf-bindings

improve this question OK I'll bite... here's some raw serializer metrics emph you may need to consider base 64 MTOM to get overall..

Serialize Class containing Dictionary member

http://stackoverflow.com/questions/495647/serialize-class-containing-dictionary-member

FileMode.OpenOrCreate FileAccess.ReadWrite try var serializer new XmlSerializer typeof ConfigFile serializer.Serialize filestream.. try var serializer new XmlSerializer typeof ConfigFile serializer.Serialize filestream this return true catch Exception e MessageBox.Show.. filename FileMode.Open FileAccess.Read try var serializer new XmlSerializer typeof ConfigFile return ConfigFile serializer.Deserialize..

How to implement custom JsonConverter in JSON.NET to deserialize a List of base class objects

http://stackoverflow.com/questions/8030538/how-to-implement-custom-jsonconverter-in-json-net-to-deserialize-a-list-of-base

reader Type objectType object existingValue JsonSerializer serializer Load JObject from stream JObject jObject JObject.Load reader.. Create objectType jObject Populate the object properties serializer.Populate jObject.CreateReader target return target public override.. WriteJson JsonWriter writer object value JsonSerializer serializer throw new NotImplementedException Hope this helps. share..

In .NET XML deserialization, how can I allow polymorphic use of Array types?

http://stackoverflow.com/questions/1007626/in-net-xml-deserialization-how-can-i-allow-polymorphic-use-of-array-types

to do with polymorphism. I think this is a bug in the XML Serializer assuming that any type named ArrayOfDog containing a sequence..

XML Serialization and Inherited Types

http://stackoverflow.com/questions/20084/xml-serialization-and-inherited-types

and I now understand why it's not working.. In that the XmlSerializer is in fact doing some clever reflection in order to serialize.. the concrete classes. Identified Issues Points to Note XmlSerializer does some pretty cool reflection but it is very limited when.. . The Xml attribute decorators define how the XmlSerializer treats the properties its finds. The physical type can also..

Parsing JSON objects to c#

http://stackoverflow.com/questions/2178821/parsing-json-objects-to-c-sharp

.net 3.5 share improve this question The Javascript Serializer in .NET is part of the System.Web.Script.Serialization namespace... public static T FromJSON T this string json JavaScriptSerializer jss new JavaScriptSerializer return jss.Deserialize T json.. T this string json JavaScriptSerializer jss new JavaScriptSerializer return jss.Deserialize T json Since this is an extension method..

How do i parse json?

http://stackoverflow.com/questions/4929434/how-do-i-parse-json

improve this question I personally prefer the JavaScriptSerializer for use with JSON in the .NET environment. By default it will..

Deserialization Error: The XML element 'name' from namespace '' is already present in the current scope

http://stackoverflow.com/questions/523245/deserialization-error-the-xml-element-name-from-namespace-is-already-prese

string public string Visible get set #endregion My Serializer Class public class Serializer public static Album CreateAlbumFromXMLDoc.. get set #endregion My Serializer Class public class Serializer public static Album CreateAlbumFromXMLDoc XmlDocument doc .. Create an instance of a serializer var serializer new XmlSerializer typeof Album var reader new StringReader doc.ToString Deserialize..

Xml serialization - Hide null values

http://stackoverflow.com/questions/5818513/xml-serialization-hide-null-values

Hide null values When using a standard .NET Xml Serializer is there any way I can hide all null values The below is an.. pattern ShouldSerialize PropertyName which tells the XmlSerializer if it should serialize the member or not. For example if your.. following code Person thePerson new Person Name Chris XmlSerializer xs new XmlSerializer typeof Person StringWriter sw new StringWriter..

protobuf-net inheritance

http://stackoverflow.com/questions/6247513/protobuf-net-inheritance

as beta use a RuntimeTypeModel rather than the static Serializer methods which are now just a short cut to RuntimeTypeModel.Default..

The deserializer has no knowlege of any type that maps to this contract

http://stackoverflow.com/questions/736900/the-deserializer-has-no-knowlege-of-any-type-that-maps-to-this-contract

it to the list of known types passed to DataContract Serializer. All classes that derive from Node including Building have the.. FileAccess.Write FileShare.None serialize DataContractSerializer ser new DataContractSerializer typeof Dictionary Guid Node InformaProject.. serialize DataContractSerializer ser new DataContractSerializer typeof Dictionary Guid Node InformaProject Informa ser.WriteObject..

ServiceStack.Net Redis: Storing Related Objects vs. Related Object Ids

http://stackoverflow.com/questions/8914349/servicestack-net-redis-storing-related-objects-vs-related-object-ids

conventionally serialized using ServiceStack's fast Json Serializer where only properties with public getters are serialized and..

How can I determine which exceptions can be thrown by a given method?

http://stackoverflow.com/questions/986180/how-can-i-determine-which-exceptions-can-be-thrown-by-a-given-method