This repository has been archived by the owner on Jun 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
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
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.
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"];