DiscriminatedUnionConverter Class
Namespace: Stimulsoft.Base.Json.Converters
Converts a F# discriminated union type to and from JSON.
Inheritance
Inherits from: JsonConverter
Properties
| Property | Type | Description |
|---|---|---|
| TagReader | FSharpFunction |
Methods
| Method | Returns | Description |
|---|---|---|
| CanConvert | bool | Determines whether this instance can convert the specified object type. |
| ReadJson | object | Reads the JSON representation of the object. |
| WriteJson | void | Writes the JSON representation of the object. |
Method Details
CanConvert
CanConvert(objectType: Type): bool
Determines whether this instance can convert the specified object type.
Parameters
- objectType (Type) — Type of the object.
Returns bool — true if this instance can convert the specified object type; otherwise, false.
ReadJson
ReadJson(reader: JsonReader, objectType: Type, existingValue: object, serializer: JsonSerializer): object
Reads the JSON representation of the object.
Parameters
- reader (JsonReader) — The JsonReader to read from.
- objectType (Type) — Type of the object.
- existingValue (object) — The existing value of object being read.
- serializer (JsonSerializer) — The calling serializer.
Returns object — The object value.
WriteJson
WriteJson(writer: JsonWriter, value: object, serializer: JsonSerializer): void
Writes the JSON representation of the object.
Parameters
- writer (JsonWriter) — The JsonWriter to write to.
- value (object) — The value.
- serializer (JsonSerializer) — The calling serializer.
Fields
| Field | Type | Description |
|---|---|---|
| Cases | List |
|
| Constructor | FSharpFunction | |
| FieldReader | FSharpFunction | |
| Fields | PropertyInfo[] | |
| Name | string | |
| Tag | int |