You could also use:
Type type = typeof(System.Web.Compilation.BuildManager);
PropertyInfo propertyInfo = type.GetProperty("AppResourcesAssembly",
BindingFlags.Static |
BindingFlags.GetField |
BindingFlags.NonPublic);
Assembly assembly = (Assembly) propertyInfo.GetValue(null, null);
string[] names = assembly.GetManifestResourceNames();
string resource = names[0];
string baseName = resource.Substring(0, resource.LastIndexOf('.'));
ResourceManager manager = new ResourceManager(baseName, assembly);
ResourceSet resources = manager.GetResourceSet(
System.Globalization.CultureInfo.CurrentCulture, true, true);
IDictionaryEnumerator enumerator = resources.GetEnumerator();
while (enumerator.MoveNext())
{
string key = (string) enumerator.Key;
string value = (string)enumerator.Value;
}
Regards
--
Milosz
"ni***********@gmail.com" wrote:
Hey Milosz,
I had been using similar code to what you have just suggested.
Unfortunately I can't seem to get a reference to the Resource file,
so:
ResourceSet resources =
Resources.Resource.ResourceManager.GetResourceSet(
resources is null :/
My workaround, which is a little ugly is:
String pathName = Server.MapPath("App_GlobalResources");
ResXResourceSet resFile = new ResXResourceSet(pathName + "\
\Time.resx");
IDictionaryEnumerator idenum = resFile.GetEnumerator();
Incidentally I tried replacing:
ResourceSet resources =
Resources.Resource.ResourceManager.GetResourceSet(
with:
ResourceSet resources =
Resources.Time.ResourceManager.GetResourceSet(