Example #1
0
        /// <summary>
        /// Gets the record converted into <see cref="Type"/> T.
        /// </summary>
        /// <typeparam name="T">The <see cref="Type"/> of the record.</typeparam>
        /// <returns>The record converted to <see cref="Type"/> T.</returns>
        public virtual T GetRecord <T>()
        {
            CheckDisposed();
            CheckHasBeenRead();

            return(GetRecordFunc <T>()(this));
        }
Example #2
0
        /// <summary>
        /// Gets all the records in the CSV file and
        /// converts each to <see cref="Type"/> T. The Read method
        /// should not be used when using this.
        /// </summary>
        /// <typeparam name="T">The <see cref="Type"/> of the record.</typeparam>
        /// <returns>An <see cref="IList{T}" /> of records.</returns>
        public virtual IList <T> GetRecords <T>()
        {
            CheckDisposed();

            var records = new List <T>();

            while (Read())
            {
                var record = GetRecordFunc <T>()(this);
                records.Add(record);
            }

            return(records);
        }