)>
Defined in Type: UniversalSerializer
Namespace: Akavache.Reactive.Core
Assembly: Akavache.Reactive.dll
Applies to
net11.0, net11.0-maccatalyst27.2, net11.0-android37.0, net11.0-macos27.2, net11.0-windows10.0.19041, net11.0-ios27.2, net10.0, net10.0-windows10.0.19041, net10.0-android36.0, net10.0-ios26.0, net10.0-maccatalyst26.0, net10.0-macos26.0, net48, net47, net471, net472, net481
Overloads
-
public static byte[] Serialize<T>(T value, ISerializer targetSerializer) -
public static byte[] Serialize<T>(T value, ISerializer targetSerializer, DateTimeKind? forcedDateTimeKind)
1. Overload
Attributes: [RequiresUnreferencedCode("Universal serialization requires types to be preserved.")] [RequiresDynamicCode("Universal serialization requires types to be preserved.")]
public static byte[] Serialize<T>(T value, ISerializer targetSerializer)
Summary: Attempts to serialize data using fallback mechanisms if the primary serializer fails.
Type parameters
| Name | Description |
|---|---|
T | The type to serialize. |
Parameters
| Name | Type | Description |
|---|---|---|
value | T | The value to serialize. |
targetSerializer | [ISerializer](# | The target serializer. |
Returns: byte[] -- The serialized data.
2. Overload
Attributes: [RequiresUnreferencedCode("Universal serialization requires types to be preserved.")] [RequiresDynamicCode("Universal serialization requires types to be preserved.")]
public static byte[] Serialize<T>(T value, ISerializer targetSerializer, DateTimeKind? forcedDateTimeKind)
Summary: Attempts to serialize data using fallback mechanisms if the primary serializer fails.
Type parameters
| Name | Description |
|---|---|
T | The type to serialize. |
Parameters
| Name | Type | Description |
|---|---|---|
value | T | The value to serialize. |
targetSerializer | [ISerializer](# | The target serializer. |
forcedDateTimeKind | DateTimeKind? | Optional DateTime kind for consistent handling. |
Returns: byte[] -- The serialized data.
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown when neither the target serializer nor any fallback serializer can serialize value. |