tags:

views:

287

answers:

1

hi everyone i have resx file to update some datas.I can read data over resx via ResXResourceSet object but when i wanna save the data back the saved data format is not clear...how to edit resx files? thanks

  ResXResourceSet st = new ResXResourceSet(@"thepath");
  entries=new List<DictionaryEntry>();    
  DictionaryEntry curEntry ;
  foreach (DictionaryEntry ent in st)
  {

      if (ent.Key.ToString() == "Page.Title")
      {
          curEntry = ent;
          curEntry.Value = "change this one"
          entries.Add(curEntry);
      }
      else
      entries.Add(ent);         
  }
  st.Close();


  System.Resources.ResourceWriter wr = new ResourceWriter(@"thepath");
  foreach (DictionaryEntry entry in entries)
  {
      wr.AddResource(entry.Key.ToString(), entry.Value.ToString());
  }
  wr.Close();
A: 

Hi again i searched up and found that..

ResourceWriter writes data as binary type ResourceReader reads data as binary type

ResXResourceWriter writes data as xml format ResXResourceReader reads data as xml format

so example on top using ResXResourceWriter,ResXResourceReader instead of ResourceReader ,ResourceWriter will manipulate resources as xml type

dankyy1
Not sure ResXResourceWriter exists anymore as of .NET 3.5
Shiftbit