开发者

adding custom column resx file

This may sound like an unusual question, but I am curious as to how i can add an additional column to the resx file setup (so i would have something like "name, value, comment, foo")

I've looked around online and haven't heard of anyone else trying something like this, but i think it might be possible to do th开发者_Python百科is by writing a new resx reader and writer. Just wanted to know if anyone had any insight on this problem, mainly i intend to use this for storing messages and logging them with a priority stored in the resource file (column foo in this case)


You can open the resx file with XML editor and modify the schema, but the built in resx editor in Visual Studio will remove any column that you add manually to the schema.

But by creating your own reader it should be possible.

[Edit] I duplicated the ResXResourceReader/Writer from the .Net framework, but when I add these to the .resx file the Managed Resource Editor in .Net throws an error. My best suggestion is to add a new column to the schema and use another editor like the one at http://madskristensen.net/post/A-NET-resource-editor-application-for-resx-files.aspx. Just modify the code to account for your extra column.


Try using a simple naming system to store the key-value pairs for your "name", e.g.:

name->"value"
name-comment->"comment value"
name-foo->"foo value"

This would let you store any number of name-key->value pairs for your "new columns".

If your requirements are more complex & subtle, then look into writing your own resource reader/writer.

Also, this sounds like you've got a requirement that more closely matches a database table. Look at using SQLite as a data store, possibly.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜