c# Programming Glossary: canconvert
JSON.net - field is either string or List<string> http://stackoverflow.com/questions/10121804/json-net-field-is-either-string-or-liststring class MoviesConverter JsonConverter public override bool CanConvert Type objectType return objectType typeof string objectType..
Parsing ISO Duration with JSON.Net http://stackoverflow.com/questions/12633588/parsing-iso-duration-with-json-net return XmlConvert.ToTimeSpan value public override bool CanConvert Type objectType return objectType typeof TimeSpan objectType..
How do I provide custom cast support for my class? http://stackoverflow.com/questions/1407689/how-do-i-provide-custom-cast-support-for-my-class ba or public static explicit operator MyType byte x if CanConvert throw new DataValueNullException Factory to convert byte x into..
Deserializing polymorphic json classes without type information using json.net http://stackoverflow.com/questions/19307752/deserializing-polymorphic-json-classes-without-type-information-using-json-net GalleryItemConverter JsonConverter public override bool CanConvert Type objectType return typeof GalleryItem .IsAssignableFrom..
Checking if a type supports an implicit or explicit type conversion to another type with .NET http://stackoverflow.com/questions/3647075/checking-if-a-type-supports-an-implicit-or-explicit-type-conversion-to-another-t is found. You could use it like this public static bool CanConvert Type fromType Type toType try Throws an exception if there..
C# JSON custom serialization http://stackoverflow.com/questions/4547550/c-sharp-json-custom-serialization class PairConverter JsonConverter public override bool CanConvert Type objectType return objectType typeof KeyValuePair string..
Json.NET: Deserializing nested dictionaries http://stackoverflow.com/questions/6416017/json-net-deserializing-nested-dictionaries return new Dictionary string object public override bool CanConvert Type objectType in addition to handling IDictionary string.. is of type object return objectType typeof object base.CanConvert objectType public override object ReadJson JsonReader reader..
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 Type objectType JObject jObject public override bool CanConvert Type objectType return typeof T .IsAssignableFrom objectType..
Serializing null in JSON.NET http://stackoverflow.com/questions/8833961/serializing-null-in-json-net itself was a breeze unfortunately this still didnt work CanConvert is never called for a property that has a null value and therefore.. class StringConverter JsonConverter public override bool CanConvert Type objectType return typeof string .IsAssignableFrom objectType..
Cannot deserialize JSON array into type - Json.NET http://stackoverflow.com/questions/9452901/cannot-deserialize-json-array-into-type-json-net CountryModelConverter JsonConverter public override bool CanConvert Type objectType if objectType typeof CountryModel return..
|