public void SetTextReaderDelegate(TextReaderDelegate readerDelegate) { if (readerDelegate == null) { throw new ArgumentNullException("readerDelegate"); } _textReaderDelegate = readerDelegate; }
public string GetText() { if (_textIsSet) { return(_text); } if (_textReaderDelegate == null) { throw new InvalidOperationException("No delegate attached to TextReaderDelegate. Use SetTextReaderDelegate."); } SetText(_textReaderDelegate(this)); // this delegate will call Binary and return the read text. _textReaderDelegate = null; // unhock delegate as it's no longer needed. return(_text); }