Class UShortSerializer
Type serializer for the ushort primitive (unsigned 16-bit integer, range 0-65,535). Writes and reads a single unsigned-short token without additional framing.
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
public sealed class UShortSerializer : TypeSerializerBase<ushort>, ITypeSerializer<ushort>, ITypeSerializer
Remarks
Use the shared Instance singleton rather than creating new instances;
UShortSerializer carries no mutable state and is safe to share across threads.
Fields
Instance
Shared, reusable singleton instance of UShortSerializer.
Prefer this over allocating a new instance wherever a UShortSerializer is needed.
Declaration
public static readonly UShortSerializer Instance
Field Value
| Type | Description |
|---|---|
| UShortSerializer |
Methods
Read(IScyllaReader, ISerializationContext)
Reads an unsigned 16-bit integer value from the reader via ReadUShort().
Declaration
public override ushort Read(IScyllaReader reader, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaReader | reader | The reader positioned at an unsigned-short token. Never |
| ISerializationContext | context | The active serialization context. Never |
Returns
| Type | Description |
|---|---|
| ushort | The deserialized unsigned short value. |
Overrides
Write(ushort, IScyllaWriter, ISerializationContext)
Writes an unsigned 16-bit integer value to the output via WriteUShort(ushort).
Declaration
public override void Write(ushort value, IScyllaWriter writer, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ushort | value | The unsigned short value to serialize (0-65,535). |
| IScyllaWriter | writer | The writer that receives the serialized token. Never |
| ISerializationContext | context | The active serialization context. Never |