Table of Contents

ComplexJsonConverter<T> Class

Definition

Namespace
Bodu.Numerics.Serialization.Json
Assembly
Bodu.Numerics.Serialization.Json.dll
Package
Bodu.Numerics.Serialization.Json 1.0.0
Source
ComplexJsonConverter{T}.cs

Converts a Complex<T> to and from JSON using the policy supplied at construction.

public sealed class ComplexJsonConverter<T> : JsonConverter<Complex<T>> where T : IFloatingPointIeee754<T>

Type Parameters

T

The floating-point component type of the complex value.

Inheritance
ComplexJsonConverter<T>
Inherited Members
Extension Methods

Remarks

The converter shape is selected by NumericsJsonPolicy:

Constructors

ComplexJsonConverter()

Initializes a new instance of the ComplexJsonConverter<T> class configured for the Strict shape.

public ComplexJsonConverter()

ComplexJsonConverter(NumericsJsonPolicy)

Initializes a new instance of the ComplexJsonConverter<T> class configured for the supplied policy.

public ComplexJsonConverter(NumericsJsonPolicy policy)

Parameters

policy NumericsJsonPolicy

The serialization policy.

Exceptions

ArgumentOutOfRangeException

policy is not a defined NumericsJsonPolicy value.

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type Bodu.Numerics.Complex{`0}.

public override Complex<T> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader

The reader.

typeToConvert Type

The type to convert.

options JsonSerializerOptions

An object that specifies serialization options to use.

Returns

Complex<T>

The converted value.

Write(Utf8JsonWriter, Complex<T>, JsonSerializerOptions)

Writes a specified value as JSON.

public override void Write(Utf8JsonWriter writer, Complex<T> value, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter

The writer to write to.

value Complex<T>

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.

Applies to

ProductVersions
.NET8, 10