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
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
bytesbyte[]The bytes.
Returns
- T
The type.
Type Parameters
TThe 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
itemTThe item to serialize.
Returns
- byte[]
The bytes.
Type Parameters
TThe type of serialize.