using System; using System.Globalization; using System.Resources; class Program { static void Main(string[] args) { // Create a new instance of the ResourceManager. ResourceManager rm = new ResourceManager(typeof(Program)); // Get the resource set for the current language and culture. ResourceSet rs = rm.GetResourceSet(CultureInfo.CurrentCulture, true, true); // Loop through the resources and print their names and values. foreach (DictionaryEntry entry in rs) { Console.WriteLine(entry.Key + ": " + entry.Value); } } }
using System; using System.Globalization; using System.Resources; class Program { static void Main(string[] args) { // Create a new instance of the ResourceManager. ResourceManager rm = new ResourceManager("Strings", typeof(Program).Assembly); // Get the resource for the specified key. string hello = rm.GetString("Hello"); // Print the resource value. Console.WriteLine(hello); } }This example creates a ResourceManager object by specifying the name of the resource file and its assembly. It then retrieves a string resource by its key and prints it to the console. Package library: System.Resources.ResourceManager