开发者

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.


you can use ResXResourceReader class, here is an example:

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜