/// <summary> /// Creates a new instance of the <see cref="CsvAsyncStreamInput"/> class as a copy of this /// one, with the given delimiter. /// </summary> /// <param name="delimiter"> /// The delimiter to use. Use <see cref="CsvTokenizer.IsValidDelimiter"/> to test whether /// or not a particular value is valid. /// </param> /// <returns> /// A new instance of the <see cref="CsvAsyncStreamInput"/> class as a copy of this one, with /// the given delimiter. /// </returns> /// <exception cref="ArgumentException"> /// Thrown when <paramref name="delimiter"/> is one of the illegal values. /// </exception> /// <exception cref="InvalidOperationException"> /// Thrown when <see cref="CsvAsyncInputBase.ProcessAsync"/> has already been called. /// </exception> public CsvAsyncStreamInput WithDelimiter(byte delimiter) { if (!CsvTokenizer.IsValidDelimiter(delimiter)) { throw new ArgumentException("Must not be a carriage return, linefeed, or double-quote.", nameof(delimiter)); } ThrowIfProcessingHasAlreadyStarted(); return(new CsvAsyncStreamInput(delimiter, _csvStream, _minReadBufferByteCount, _readBufferPool, _ignoreUTF8ByteOrderMark)); }
/// <summary> /// Creates a new instance of the <see cref="CsvReadOnlySequenceInput"/> class as a copy of this /// one, with the given delimiter. /// </summary> /// <param name="delimiter"> /// The delimiter to use. Use <see cref="CsvTokenizer.IsValidDelimiter"/> to test whether /// or not a particular value is valid. /// </param> /// <returns> /// A new instance of the <see cref="CsvReadOnlySequenceInput"/> class as a copy of this one, with /// the given delimiter. /// </returns> /// <exception cref="ArgumentException"> /// Thrown when <paramref name="delimiter"/> is one of the illegal values. /// </exception> /// <exception cref="InvalidOperationException"> /// Thrown when <see cref="CsvSyncInputBase.Process"/> has already been called. /// </exception> public CsvReadOnlySequenceInput WithDelimiter(byte delimiter) { if (!CsvTokenizer.IsValidDelimiter(delimiter)) { throw new ArgumentException("Must not be a carriage return, linefeed, or double-quote.", nameof(delimiter)); } ThrowIfProcessingHasAlreadyStarted(); return(new CsvReadOnlySequenceInput(delimiter, _sequence, _ignoreUTF8ByteOrderMark)); }
/// <summary> /// Creates a new instance of the <see cref="CsvAsyncStreamInput"/> class as a copy of this /// one, with the given delimiter. /// </summary> /// <param name="delimiter"> /// The delimiter to use. Use <see cref="CsvTokenizer.IsValidDelimiter"/> to test whether /// or not a particular value is valid. /// </param> /// <returns> /// A new instance of the <see cref="CsvAsyncStreamInput"/> class as a copy of this one, with /// the given delimiter. /// </returns> /// <exception cref="ArgumentException"> /// Thrown when <paramref name="delimiter"/> is one of the illegal values. /// </exception> /// <exception cref="InvalidOperationException"> /// Thrown when <see cref="CsvAsyncInputBase.ProcessAsync"/> has already been called. /// </exception> public CsvAsyncStreamInput WithDelimiter(byte delimiter) { if (!CsvTokenizer.IsValidDelimiter(delimiter)) { #pragma warning disable CA1303 // Do not pass literals as localized parameters throw new ArgumentException("Must not be a carriage return, linefeed, or double-quote.", nameof(delimiter)); #pragma warning restore CA1303 // Do not pass literals as localized parameters } ThrowIfProcessingHasAlreadyStarted(); return(new CsvAsyncStreamInput(delimiter, _csvStream, _minReadBufferByteCount, _readBufferPool, _ignoreUTF8ByteOrderMark)); }