Skip to content

Simplify.Resources

Alexanderius edited this page Jan 23, 2021 · 3 revisions

Simplify.Resources Documentation

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"];