the type or namespace “TextFieldParser” could not be found

女生的网名这么多〃 提交于 2019-12-04 03:42:19

问题


I am trying to use TextfieldParser that was found within Reading CSV files using C#. I am using VS 2010 and doing this in C#.

I keep on getting "the type or namespace "TextFieldParser" could not be found.."

When I try and add the using line, it will only go using Microsoft.VisualBasic; deep and not using Microsoft.VisualBasic.FileIO;

Any help would be great.


回答1:


In Visual Studio, right click on References in the Solution Explorer side panel. Click "Add Reference".

In that list be sure to check Microsoft.VisualBasic. Hit OK.

Now in the namespace, add Using Microsoft.VisualBasic.FileIO.

That will allow you to use TextFieldParser. For a good, easy example on how to use it, look here: http://geekswithblogs.net/brians/archive/2010/07/07/whats-a-nice-class-like-textfieldparser-doing-in-a-namespace.aspx




回答2:


Added it as a reference and now it seems to work.



来源:https://stackoverflow.com/questions/15419475/the-type-or-namespace-textfieldparser-could-not-be-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!