public static T Deserialize <T> (Stream stream, IBinaryReaderSurrogate?surrogate = default) { using var reader = new StreamBinaryReader(stream, surrogate); return((T)reader.Read(typeof(T)) !); }
public static object?Deserialize(Stream stream, Type type, IBinaryReaderSurrogate?surrogate = default) { using var reader = new StreamBinaryReader(stream, surrogate); return(reader.Read(type)); }