Create resource file and read value from it : Resource ResX : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Resource ResX »

 

Create resource file and read value from it









    


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

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

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

      ResourceSet Rs = new ResourceSet("navioo.resources");

      Console.WriteLine(Rs.GetString("key 1 ", true));
      Console.WriteLine(Rs.GetString("key 2", true));
      Console.WriteLine(Rs.GetString("key 3", true));
      Console.WriteLine(Rs.GetDefaultReader().ToString());

      Rs.Close();

   }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Resource ResX