Class DeserializationResult
Represents the result of deserializing a Confluent wire format message.
public sealed class DeserializationResult
- Inheritance
-
DeserializationResult
- Inherited Members
- Extension Methods
Remarks
This type provides runtime type information alongside the deserialized message, enabling dynamic dispatch scenarios where the message type is only known after deserialization.
Constructors
DeserializationResult(object, Type, int, int)
Initializes a new instance of the DeserializationResult class.
public DeserializationResult(object message, Type messageType, int schemaId, int version)
Parameters
messageobjectThe deserialized message.
messageTypeTypeThe .NET type of the message.
schemaIdintThe Schema Registry ID used for deserialization.
versionintThe message version (if applicable).
Properties
Message
Gets the deserialized message.
public object Message { get; }
Property Value
- object
The message object.
MessageType
Gets the .NET type of the deserialized message.
public Type MessageType { get; }
Property Value
- Type
The message type.
SchemaId
Gets the Schema Registry ID that was used for deserialization.
public int SchemaId { get; }
Property Value
- int
The schema ID from the wire format header.
Version
Gets the message version (for versioned messages).
public int Version { get; }
Property Value
- int
The version number if the message implements
IVersionedMessage; otherwise, 1.
Methods
As<T>()
Casts the deserialized message to the specified type.
public T As<T>()
Returns
- T
The message cast to
T.
Type Parameters
TThe expected message type.
Exceptions
- InvalidCastException
The message cannot be cast to
T.