3

I am trying to find a easy example or introduction to a CSV Type provider. So I followed this link to help me get started. Now I have a Visual Studio 2012 students edition and while documentation says that F# 3.0 has the CSV type provider I am not able to find it. So I am trying to use a type provider for a local CSV File. What I see is that the CSV TypeProvider mentioned does not exist at all. Since the given examples don't really compile I looked around and used something like this to load the oData services :

#r "FSharp.Data.TypeProviders"
///loading a stackoverflow odata type provider
type stackOverflow = Microsoft.FSharp.Data.TypeProviders.ODataService<"http://data.stackexchange.com/stackoverflow/atom">

So this is a bit different from what is mentioned in the example page above. I am not able to see the csv type provider. I use the Visual Studio IDE to list the type providers and csv is not listed. I tried updating the packages using nuget and this still persists. Can anyone point the right documentation on how to work with a csv type provider and also the right updated links where a simple example could be found?

4

2 回答 2

7

FSharp.Data 不是内置库,因此您需要使用 nuget 或手动下载包。有关从何处获取它(以及如何使用它)的更多信息,请参见此处。

如果您手动下载该项目,您可以将它放在任何您想要的位置,然后只需使用文件路径来引用它#r。对于相对于您的项目的路径,请使用__SOURCE_DIRECTORY__符号,否则您可以简单地使用 .dll 的绝对文件路径。

引用dll后,还需要打开命名空间,所以open FSharp.Data引用dll后需要有。

于 2013-07-31T14:59:57.747 回答
0

好吧,这就是我所做的。我使用 Nuget 来管理引用并安装了 FSharp.Data 和 FSharp.Data.TypeProviders 并且像@mydogisbox 提到的那样我然后使用打开的 FSharp.Data 加载 csv 文件,即

open FSharp.Data.Csv

虽然这在我使用 Nuget 时有效,但在其他情况下它不起作用。所以必须弄清楚如何做到这一点。现在我想这应该足够了。

于 2013-07-31T14:56:14.880 回答