FSharp.Configuration


The ResX type provider

This tutorial shows the use of the ResX type provider. It allows typed access to .resx files.

Create a resource file in Visual Studio like:

alt text

Reference the type provider assembly and configure it to use your Resource1.resx file:

1: 
2: 
3: 
4: 
5: 
6: 
// reference the type provider dll
#r "FSharp.Configuration.dll"
open FSharp.Configuration

// Let the type provider do it's work
type Resource1 = ResXProvider<file="Resource1.resx">

Now you have typed access to .resx files:

alt text

Reading from the resx file

1: 
2: 
Resource1.Greetings
val it : string = "Hello World!"
Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
namespace FSharp.Configuration
type Resource1 = ResXProvider<...>

Full name: ResXProvider.Resource1
Multiple items
module ResXProvider

from FSharp.Configuration

--------------------
type ResXProvider

Full name: FSharp.Configuration.ResXProvider
property ResXProvider<...>.Greetings: string


Greetings
Fork me on GitHub