Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TryDeserialise and TrySerialise #16

Open
drewnoakes opened this issue Jan 24, 2016 · 0 comments
Open

Support TryDeserialise and TrySerialise #16

drewnoakes opened this issue Jan 24, 2016 · 0 comments

Comments

@drewnoakes
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant