Class WebSocketActorDaprSerializer
- Namespace
- Virtufin.WebSocketManager.Actors
- Assembly
- Virtufin.WebSocketManager.dll
public sealed class WebSocketActorDaprSerializer : IDaprSerializer
- Inheritance
-
WebSocketActorDaprSerializer
- Implements
-
IDaprSerializer
- Inherited Members
Methods
Deserialize(string?, Type)
Deserializes a string to an object of the specified type.
[RequiresUnreferencedCode("Runtime-type deserialization is not used by this actor.")]
[RequiresDynamicCode("Runtime-type deserialization is not used by this actor.")]
public object? Deserialize(string? data, Type returnType)
Parameters
datastringThe string data to deserialize. Can be null or empty.
returnTypeTypeThe target type to deserialize to.
Returns
- object
The deserialized object, or
nullifdatais null or empty.
Remarks
Prefer Deserialize<T>(string) when the type is known at compile time.
Exceptions
- ArgumentNullException
Thrown if
returnTypeis null.
Deserialize<T>(string?)
Deserializes a string to an object of the specified type.
public T? Deserialize<T>(string? data)
Parameters
datastringThe string data to deserialize. Can be null or empty.
Returns
- T
The deserialized object of type
T, ordefault(T)ifdatais null or empty.
Type Parameters
TThe target type to deserialize to.
Serialize(object?, Type?)
Serializes an object to a string representation using an optional type hint.
[RequiresUnreferencedCode("Runtime-type serialization is not used by this actor.")]
[RequiresDynamicCode("Runtime-type serialization is not used by this actor.")]
public string Serialize(object? value, Type? inputType = null)
Parameters
valueobjectThe object to serialize. Can be null.
inputTypeTypeOptional type hint for the object being serialized. Some serializers may use this for better type fidelity. If null, the serializer should use the runtime type of
value.
Returns
- string
A string representation of the object. Returns an empty string if
valueis null.
Remarks
Prefer Dapr.Common.Serialization.IDaprSerializer.Serialize<T>(T) when the type is known at compile time.
Serialize<T>(T)
Serializes a value of a known type to its string representation.
public string Serialize<T>(T value)
Parameters
valueTThe value to serialize. Can be null.
Returns
- string
A string representation of the value. Returns an empty string if
valueis null.
Type Parameters
TThe compile-time type of the value being serialized.