/// <summary> /// Read from the stream, decode from base64, then deserialize /// the result. /// </summary> /// <param name="stream">Stream to read from.</param> private static object DeserialiseFrom(Stream stream) { // Decode from base64, then deserialise the result. using (Stream cryptoStream = new CryptoStream(stream, new FromBase64Transform(), CryptoStreamMode.Read, leaveOpen: true)) return(ReflectionUtilities.BinaryDeserialise(cryptoStream)); }