Basic Reader Example:
            var rsxr = new ResXResourceReader("demo.resx");
            foreach (DictionaryEntry d in rsxr)
            {
                Console.WriteLine(pathRelativeToStartingPath + ",\"" + d.Key + "\",\"" + d.Value + "\"");
            }
            rsxr.Close();            
          Basic Writer Example:
            string txt = "One smart fellow, he felt smart";
            string txt_fr = "Un garçon intelligent, il se sentait à puce";
            ResXResourceWriter rsxw = new ResXResourceWriter("demo.resx");
            rsxw.AddResource("MyText", txt);
            rsxw.Close();
            ResXResourceWriter rsxw_fr = new ResXResourceWriter("demo.fr-FR.resx");
            rsxw_fr.AddResource("MyText", txt_fr);
            rsxw_fr.Close();     
   Of course if you are putting images or media into your resx file you'll additional code to handle the different types that value can be.
 
No comments:
Post a Comment