ResourceWriter.Generate() : ResourceWriter « System.Resources « C# / C Sharp by API






ResourceWriter.Generate()

 


using System;
using System.Globalization;
using System.Resources;
using System.Collections;

class Class1 {
  static void Main(string[] args) {
      ResourceWriter resourceWriter = new ResourceWriter("Java2s.resources");

      resourceWriter.AddResource("key 1", "First value");
      resourceWriter.AddResource("key 2", "Second value");
      resourceWriter.AddResource("key 3", "Third value");
      resourceWriter.Generate();
      resourceWriter.Close();

      ResourceReader resourceReader = new ResourceReader("Java2s.resources");
      IDictionaryEnumerator resourceReaderEn = resourceReader.GetEnumerator();
      while (resourceReaderEn.MoveNext())
      {
         Console.WriteLine("Name: {0} - Value: {1}", 
            resourceReaderEn.Key.ToString().PadRight(10, ' '), 
            resourceReaderEn.Value);
      }
      resourceReader.Close();
   }
}

   
  








Related examples in the same category

1.new ResourceWriter
2.ResourceWriter.AddResource
3.ResourceWriter.AddResource(String key, Image value)