跳绳FileHelper列 [英] Skipping a column in FileHelper
问题描述
使用 FileHelper 库的.Net,我可以以某种方式跳过一些列从源文件?
Using the FileHelper library for .Net, can I somehow skip a number of columns from the source file?
根据文档和示例,我要添加字段的所有列。唉,我有一个Excel工作表有216列进口,从少至13是必要的。
According to docs and samples, I have to add fields for all columns. Alas, I have an excel sheet with 216 columns to import, from which as few as 13 are necessary.
推荐答案
我有同样的情况,和问题。搜索论坛在filehelpers.net,我发现这个线程(从2007年?!),与马科斯本人的回应:
I have the same situation, and question. Searching the forums at filehelpers.net, I found this thread (from 2007?!) with a response by Marcos himself:
问:
在一个分隔长的布局,是有可能跳过一些领域?例如:
ExternalSysId | ExportDate |姓|姓氏
我只想名字和姓氏,并且不希望扰乱我的code与虚拟字段?
In a delimited length layout, is it possible to skip some fields? For example:
ExternalSysId|ExportDate|FirstName|LastName
I only want FirstName and LastName, and don't want to clutter up my code with "dummy" fields?
响应:
该库没有一个为这个内置的功能。
可以让私人领域,磁带库将读取的值,但你不要看他们从code =)如果将来需要这些字段可以meke予以公布
The library dont have a built in feature for this.
You can make the fields private, the library will read the values, but you dont see them from your code =) If in the future you need these fields you can meke them public
因此,使用记录类向导,以减少所需键入量,然后再作无谓的私人领域,看起来像在这一点上是最好的选择。
So, using the Record Class Wizard to reduce the amount of required typing, and then making unnecessary fields private, looks like the best option at this point.
这篇关于跳绳FileHelper列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!