Table of Contents

Interface ISerializer

Namespace
Akavache
Assembly
Akavache.dll

Determines how to serialize to and from a byte.

public interface ISerializer
Extension Methods

Properties

ForcedDateTimeKind

Gets or sets the DateTimeKind handling for BSON readers to be forced.

DateTimeKind? ForcedDateTimeKind { get; set; }

Property Value

DateTimeKind?

Remarks

By default, BsonReader uses a DateTimeKind of Local and see BsonWriter uses Utc. Thus, DateTimes are serialized as UTC but deserialized as local time. To force BSON readers to use some other DateTimeKind, you can set this value.

Methods

Deserialize<T>(byte[])

Deserializes from bytes.

[RequiresUnreferencedCode("Using System.Text.Json requires types to be preserved for serialization.")]
[RequiresDynamicCode("Using System.Text.Json requires types to be preserved for serialization.")]
T? Deserialize<T>(byte[] bytes)

Parameters

bytes byte[]

The bytes.

Returns

T

The type.

Type Parameters

T

The type to deserialize to.

Serialize<T>(T)

Serializes to an bytes.

[RequiresUnreferencedCode("Using System.Text.Json requires types to be preserved for serialization.")]
[RequiresDynamicCode("Using System.Text.Json requires types to be preserved for serialization.")]
byte[] Serialize<T>(T item)

Parameters

item T

The item to serialize.

Returns

byte[]

The bytes.

Type Parameters

T

The type of serialize.