Modify .resx file at runtime

Posted by Gerry Whitworth on Stack Overflow See other posts from Stack Overflow or by Gerry Whitworth
Published on 2012-12-08T22:59:47Z Indexed on 2012/12/08 23:03 UTC
Read the original article Hit count: 225

Filed under:

Building a ASP.NET MVC site and I would like to add some values to my .resx file at run time.

I have tried:

IResourceWriter writer = new ResourceWriter("myResources.resources");
writer.AddResource("String 3", "Third String");
writer.Close();

This code compiles and executes fine but after I close the website and look at the .resx file it is corrupt and I must re-create the .resx file again. Note that I have two values in this .resx file I added at design time.

Thanks Gerry

© Stack Overflow or respective owner

Related posts about asp.net-mvc