ResourceReader.GetEnumerator() : ResourceReader « System.Resources « C# / C Sharp by API






ResourceReader.GetEnumerator()

  

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

public class MainClass {
    public static void DumpResources(string resName) {
        ResourceReader reader = new ResourceReader(resName);
        IDictionaryEnumerator en = reader.GetEnumerator();
        while (en.MoveNext()) {
            Console.WriteLine("Resource Name: [{0}] = {1}", en.Key, en.Value);
        }
        reader.Close();
    }

    public static void DumpAResource(string resName, string keyName) {
        try {
            ResourceManager rMgr = new ResourceManager(resName,
             System.Reflection.Assembly.GetExecutingAssembly());
            Console.WriteLine("Resource: {0}", rMgr.GetString(keyName));
        } catch (Exception e) {
            Console.WriteLine("Exception creating manager {0}", e);
            return;
        }
    }

    public static void Main(string[] args) {
        for (int i = 0; i < args.Length; ++i)
            DumpAResource("English", args[i]);
        DumpResources("English1.resources");
    }
}

   
    
  








Related examples in the same category