public void SetDownloadBinaryDelegate(DownloadBinaryDelegate downloadBinary)
    {
        if (downloadBinary == null)
        {
            throw new ArgumentNullException("downloadBinary");
        }

        _downloadBinaryDelegate = downloadBinary;
    }
    public byte[] GetBinary()
    {
        if (_binaryIsSet)
        {
            return(_bytes);
        }

        if (_downloadBinaryDelegate == null)
        {
            throw new InvalidOperationException("No delegate attached to DownloadBinaryDelegate. Use SetDownloadBinaryDelegate.");
        }

        SetBinary(_downloadBinaryDelegate(this));
        _downloadBinaryDelegate = null;         // unhock delegate as it's no longer needed.

        return(_bytes);
    }