public void TestReaderGetRecordCustomFieldsFewerThanActualColumns() { using (var stream = new MemoryStream()) using (var writer = new StreamWriter(stream)) using (var reader = new StreamReader(stream)) using (var dtReader = new DelimitedTextReader(reader)) { writer.Write("Field1,Field2,Field3,Field4,Field5\r\n"); writer.Write("value1,100,true,\"12/31/2016\", 25.76\r\n"); writer.Flush(); stream.Position = 0; dtReader.FirstRowIsHeader = false; dtReader.ShouldSkipRecord = (row => row[0] == "Field1"); dtReader.AddColumn("F1"); dtReader.AddColumn("F2"); dtReader.AddColumn("F3"); dtReader.AddColumn("F4"); dtReader.Read(); TestRecord trecord = dtReader.GetRecord <TestRecord>(); Assert.NotNull(trecord); Assert.Equal("value1", trecord.Field1); Assert.Equal(100, trecord.Field2); Assert.True(trecord.Field3); Assert.Equal(DateTime.Parse("12/31/2016").ToShortDateString(), trecord.Field4.ToShortDateString()); } }