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 ResX = ResXProvider<file="Resource1.resx">

Now you have typed access to .resx files:

alt text

Reading from the resx file

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

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

Full name: ResXProvider.ResX
Multiple items
module ResXProvider

from FSharp.Configuration

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

Full name: FSharp.Configuration.ResXProvider
type Resource1 =
  static member AlternativeGreetings : string
  static member Flowers : Bitmap
  static member Greetings : string

Full name: FSharp.Configuration.ResXProvider,file="Resource1.resx".Resource1
property ResXProvider<...>.Resource1.Greetings: string


Greetings
Fork me on GitHub