Skip to content

Support TryDeserialise and TrySerialise #16

@drewnoakes

Description

@drewnoakes

These versions should not throw, but rather return true/false.

bool TrySerialise(Stream, object)       // if false, stream is left in unspecified state
bool TrySerialise(UnsafePacker, object) // if false, packer is left in unspecified state
bool TrySerialise(object, out byte[])   // if false, byte[] is null

bool TryDeserialise(Stream)             // if false, stream is left in unspecified state
bool TryDeserialise(Unpacker)           // if false, unpacker is left in unspecified state
bool TryDeserialise(byte[], out object) // if false, object is null

Duplicate the above for the generic Serialiser<T> and Deserialiser<T>.

Before implementing this, consider whether the Stream/Unpacker overloads actually make sense. Leaving the streams in an unspecified state is basically unrecoverable. Consider the scenarios here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions