Question

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 this 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)

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top