/// <summary> /// Makes it so all calls to Read and Peek are passed the ChainableReader /// passed as a parameter. /// </summary> /// <param name="parentChainedReader">ChainableReader to forward calls to</param> public virtual void Chain(ChainableReader parentChainedReader) { if (parentChainedReader == null) { throw new ArgumentNullException("parentChainedReader", "Argument can not be null"); } //Assign delegates InternalRead = new internalRead(parentChainedReader.Read); InternalPeek = new internalPeek(parentChainedReader.Peek); InternalClose = new internalClose(parentChainedReader.Close); //This is just a reader in the chain _baseReader = false; }
/// <summary> /// Makes it so all calls to Read and Peek are passed the TextReader /// passed as a parameter. /// </summary> /// <param name="baseReader">TextReader to forward calls to</param> public virtual void Chain(TextReader baseReader) { if (baseReader == null) { throw new ArgumentNullException("baseReader", "Argument can not be null"); } // Assign delegates InternalRead = new internalRead(baseReader.Read); InternalPeek = new internalPeek(baseReader.Peek); InternalClose = new internalClose(baseReader.Close); // This is the base reader _baseReader = true; }