Пример #1
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <param name="disposing">True if the instance needs to be disposed of.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                reader?.Dispose();
            }

            disposed = true;
            reader   = null;
        }
Пример #2
0
        /// <summary>
        /// Creates a new parser using the given <see cref="TextReader"/> and <see cref="CsvConfiguration"/>.
        /// </summary>
        /// <param name="reader">The <see cref="TextReader"/> with the CSV file data.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="leaveOpen">true to leave the reader open after the CsvReader object is disposed, otherwise false.</param>
        public CsvParser(TextReader reader, CsvConfiguration configuration, bool leaveOpen)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            this.reader        = new FieldReader(reader, configuration);
            this.configuration = configuration;
            this.leaveOpen     = leaveOpen;
        }
Пример #3
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <param name="disposing">True if the instance needs to be disposed of.</param>
        protected virtual void Dispose( bool disposing )
        {
            if( disposed )
            {
                return;
            }

            if( disposing )
            {
                reader?.Dispose();
            }

            disposed = true;
            reader = null;
        }
Пример #4
0
        /// <summary>
        /// Creates a new parser using the given <see cref="TextReader"/> and <see cref="CsvConfiguration"/>.
        /// </summary>
        /// <param name="reader">The <see cref="TextReader"/> with the CSV file data.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="leaveOpen">true to leave the reader open after the CsvReader object is disposed, otherwise false.</param>
        public CsvParser( TextReader reader, ICsvParserConfiguration configuration, bool leaveOpen )
        {
            if( reader == null )
            {
                throw new ArgumentNullException( nameof( reader ) );
            }

            if( configuration == null )
            {
                throw new ArgumentNullException( nameof( configuration ) );
            }

            this.reader = new FieldReader( reader, configuration );
            this.configuration = configuration;
            this.leaveOpen = leaveOpen;
        }