Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i am trying to add a list of values to my existing resource file
For example in my resource file i have key value pair like this....

"resourceTestKey1" - "resourceTestValue1"
"resourceTestKey2" - "resourceTestValue2"
"resourceTestKey3" - "resourceTestValue3"
"resourceTestKey4" - "resourceTestValue4"

Currently i am trying to add one more key value pair to my Resource File using below code
C#
System.Resources.ResXResourceWriter resWriter = new System.Resources.ResXResourceWriter(this.resourceFilePath);                                
resWriter.AddResource("resourceTestKey5","resourceTestValue5");

Now all my old resource file values are deleted..
and resource file contains only this entry "resourceTestKey5","resourceTestValue5"

How can i add a new resource key value pair by retaining the current values
Posted
Updated 29-May-11 21:53pm
v2

1 solution

To create a.resx file, create a ResXResourceWriter with a unique file name, call AddResource at least once, call Generate to write the resources file to disk, and then call Close to close the file. Calling Close will implicitly Generate the file if required.

Hope it helps
 
Share this answer
 
Comments
arun_pk 30-May-11 3:53am    
My problem is retaining the existing values in an existing resource file....
some thing like appending values

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900