eyalb
eyalb

Reputation: 3022

how to add items to resource file (resx) on run time?

i have some global resource files that store my dictionary for app.
when a key is not in the resource file i return the key.

public Object MyGetGlobalResourceObject(string classKey, string resourceKey)
    {
        try
        {
            if (GetGlobalResourceObject(classKey, resourceKey) == null)
            {
                return resourceKey;
            }
            else
                return GetGlobalResourceObject(classKey, resourceKey);

        }
        catch (MissingManifestResourceException ex)
        {
             return classKey + "-" + resourceKey + " " + ex.ToString();
        }
    }

i want to add the resourceKey to the classKey file.

Upvotes: 0

Views: 1765

Answers (1)

Robert
Robert

Reputation: 3302

you can use ResXResourceReader class, here is an example:

http://www.codeproject.com/KB/cs/Editing_a_ResourceFile.aspx?msg=3406807

Upvotes: 1

Related Questions