Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Simplify.Resources

i4004 edited this page Sep 13, 2014 · 3 revisions

Provides StringTable.Entry ambient context and ResourcesStringTable, IResourcesStringTable for getting strings from assembly resource files.

Available at NuGet as binary package

Basic example

Getting string from executing assembly:

var str = StringTable.Entry["FooString"];

Resource file should be named ProgramResources.resx and set as Embedded Resource. Assembly default namespace should be equal to assembly name.

Custom ResourcesStringTable

You can create a custom ResourcesStringTable class instance with custom assembly from which to get resources:

var rst = new ResourcesStringTable(Assembly.GetAssembly(typeof (MyType)), "ProgramResources");
var str = rst["FooString"];

Specifying resource base name (in case if your default namespace is not equal to assembly name)

var rst = new ResourcesStringTable(Assembly.GetAssembly(typeof (MyType)), "ProgramResources", "YourDefaultNamespace");
var str = rst["FooString"];