I first came across a question similar to mine here at stack overflow: Loop through all Resources in ResourceManager - C#. It only solved part of what I need to do. When you request an entry in a resource file for a specific culture, if there is not one present it will default back on the neutral culture resource file.
I need to loop through each entry for a given resource file and GetResourceSet requires a culture. For example I have a neutral resource file with 3 entries in it and a culture specific resource file accompanying the neutral file with 1 entry.
My neutral resource example file is MyResource.resx and my culture specific resource example file is MyResource.en-gb.resx. The following code shows how I am currently trying to loop through and access all of the resource entries.
Dim cultInfo as New CultureInfo(culture)
For Each entry As System.Collections.DictionaryEntry In myResourceManager.GetResourceSet(cultInfo, True, True)
Next
Neutral Resource File Entries
- FullName / Full Name
- PhoneNumber / Phone Number
- State / State
Culture Specific Resource File Entry
- State / County
When I call GetResourceSet for the specific culture I only get back 1 entry. I was expecting (and want) to get back all 3 entries with the one culture specific entry overridden. Here is what I want returned:
- FullName / Full Name
- PhoneNumber / Phone Number
- State / County
Is there anyway that I can do this? Thanks.
GetResourceSet
method does not reflect what's in the documentation. – Bufordbug