本文整理汇总了C#中CsvReader.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# CsvReader.GetData方法的具体用法?C# CsvReader.GetData怎么用?C# CsvReader.GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsvReader
的用法示例。
在下文中一共展示了CsvReader.GetData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportRows
private IEnumerable<IImportRow> ImportRows(CsvReader reader)
{
using ( reader )
{
reader.GetHeader();
return reader.GetData<WestpacVisaCsvImportRow>().ToArray();
}
}
示例2: ImportRows
private static IEnumerable<IImportRow> ImportRows(CsvReader reader)
{
using (reader)
{
reader.GetHeader(skip: l => !l.StartsWith("Date", StringComparison.OrdinalIgnoreCase));
return reader.GetData<AsbVisaCsvImportRow>().ToArray();
}
}
示例3: DecodeAsbImport
public void DecodeAsbImport()
{
var filename = TestSettings.GetFilename(ASB_FILENAME);
using (var reader = new CsvReader(filename))
{
reader.GetHeader(skip: l => !l.StartsWith("Date", StringComparison.OrdinalIgnoreCase));
AsbOrbitFastTrackCsvImportRow actual = reader.GetData<AsbOrbitFastTrackCsvImportRow>().First();
Assert.That(actual.Date, Is.EqualTo(DateTime.Parse("2012/08/05")));
Assert.That(actual.UniqueId, Is.EqualTo("2012080501"));
Assert.That(actual.Amount, Is.EqualTo(-3.80M));
Assert.That(actual.TranType, Is.EqualTo("TFR OUT"));
}
}
示例4: DecodeData
public void DecodeData()
{
MemoryStream csv = BuildCsv("A,B,C", "1,2,3");
using (var reader = new CsvReader(csv))
{
IEnumerable<string> header = reader.GetHeader();
Assert.That(header, Is.EqualTo(new[] {"A", "B", "C"}));
IEnumerable<string[]> data = reader.GetData();
Assert.That(data, Is.EquivalentTo(new[] {new[] {"1", "2", "3"}}));
}
}
示例5: DecodeWestpacImport
public void DecodeWestpacImport()
{
var filename = TestSettings.GetFilename(WP_FILENAME);
using (var reader = new CsvReader(filename))
{
WestpacCsvImportRow actual = reader.GetData<WestpacCsvImportRow>().First();
Assert.That(actual.Date, Is.EqualTo(DateTime.Parse("13/08/2012")));
Assert.That(actual.Amount, Is.EqualTo(-140M));
Assert.That(actual.OtherParty, Is.EqualTo("Countdown Ri WBC ATM"));
}
}
示例6: DecodeHeaderWithSpacesAsObject
public void DecodeHeaderWithSpacesAsObject()
{
MemoryStream csv = BuildCsv("A Value,B*Value,C%Value", "A1,B2,C3");
using (var reader = new CsvReader(csv))
{
TestObj actual = reader.GetData<TestObj>().First();
Assert.That(actual.AValue, Is.EqualTo("A1"));
Assert.That(actual.BValue, Is.EqualTo("B2"));
Assert.That(actual.CValue, Is.EqualTo("C3"));
}
}
示例7: DecodeDataAsObject
public void DecodeDataAsObject()
{
MemoryStream csv = BuildCsv("A,B,C", "1,2,3");
using (var reader = new CsvReader(csv))
{
IEnumerable<string> header = reader.GetHeader();
Assert.That(header, Is.EqualTo(new[] {"A", "B", "C"}));
TestObj actual = reader.GetData<TestObj>().First();
Assert.That(actual.A, Is.EqualTo(1));
Assert.That(actual.B, Is.EqualTo(2));
Assert.That(actual.C, Is.EqualTo(3));
}
}