Providers

F# supports different types of provider, such as:

  • HtmlProvider<>
  • JsonProvider<>
  • XmlProvider<>
  • WorldBankDataProvider<>
  • CsvProvider<>

Let's discuss one of them, for example, the CSV type provider. The FSharp.Data NuGet package contains CsvProvider. We can pass a .csv file and can read other .csv files; for example, we created a .csv file as follows:

Now, we have another .csv file which we want to read:

Here is a code snippet:

open FSharp.Data  type Books = CsvProvider<"..\ExampleCSV.csv"> let Saleitems = Books.Load("..\ExampleCSV-2.csv") ...

Get .NET Core 2.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.