本文整理汇总了C#中CsvReader.GetHeader方法的典型用法代码示例。如果您正苦于以下问题:C# CsvReader.GetHeader方法的具体用法?C# CsvReader.GetHeader怎么用?C# CsvReader.GetHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsvReader
的用法示例。
在下文中一共展示了CsvReader.GetHeader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: DecodeHeader
public void DecodeHeader()
{
MemoryStream csv = BuildCsv("A,B,C");
using (var reader = new CsvReader(csv))
{
IEnumerable<string> header = reader.GetHeader();
Assert.That(header, Is.EqualTo(new[] {"A", "B", "C"}));
}
}
示例6: 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));
}
}