Table of Contents

Method TryRead

Namespace
GrindFest
Assembly
GrindFest.dll

TryRead<T>(byte[], out T)

Reads a payload written by Write<T>(T, byte). False means it is missing, empty, or not readable as T - callers treat that as "nothing to restore" rather than an error, as they always have.

public static bool TryRead<T>(byte[] payload, out T value) where T : class

Parameters

payload byte[]
value T

Returns

bool

Type Parameters

T

TryRead<T>(byte[], out T, out byte)

Same, and also reports version so a component can migrate its own payload: switch on the value it finds here, read the older shape as its own older struct, and refuse a payload from the future with if (version > MyVersion) return;.

public static bool TryRead<T>(byte[] payload, out T value, out byte version) where T : class

Parameters

payload byte[]
value T
version byte

Returns

bool

Type Parameters

T