FileHelpers: How to skip first and last line reading fixed width text

前端 未结 3 885
无人共我
无人共我 2021-02-19 02:31

Code below is used to read fixed width uploaded file content text file using FileHelpers in ASP .NET MVC2

First and last line lengths are smaller and ReadStream causes e

3条回答
  •  星月不相逢
    2021-02-19 03:00

    You can use these attributes

    IgnoreFirst: Indicates the numbers of lines to be ignored at the begining of a file or stream when the engine read it.

    [IgnoreFirst(1)] 
    public class OrdersVerticalBar 
    { ...
    

    IgnoreLast: Indicates the numbers of lines to be ignored at the end of a file or stream when the engine read it.

    [IgnoreLast(1)] 
    public class OrdersVerticalBar 
    { ...
    

    You can access the values later with

    engine.HeaderText
    engine.FooterText
    

提交回复
热议问题