/// <summary> /// Loads the contents returned by the given reader into the DataTable. /// </summary> /// <param name="table">The table to load the file contents into.</param> /// <param name="reader">The reader to use to extract the file schema and data.</param> /// <exception cref="System.ArgumentNullException">The table is null.</exception> /// <exception cref="System.ArgumentNullException">The reader is null.</exception> public static void ReadFlatFile(this DataTable table, IReader reader) { if (table == null) { throw new ArgumentNullException("table"); } if (reader == null) { throw new ArgumentNullException("reader"); } table.Reset(); FlatFileReader fileReader = new FlatFileReader(reader); table.Load(fileReader, LoadOption.OverwriteChanges); }