|
Using Resource Manager
using System;
using System.Resources;
using System.Threading;
using System.Reflection;
using System.Globalization;
class ResourcesExample
{
public static void Main()
{
// Create a resource manager to retrieve resources.
ResourceManager rm = new ResourceManager("resourceManager.Application",
Assembly.GetExecutingAssembly());
// Get the culture of the currently executing thread.
// The value of ci will determine the culture of
// the resources that the resource manager retrieves.
CultureInfo ci = Thread.CurrentThread.CurrentCulture;
// Retrieve the value of the string resource named
// "welcome", localized for the culture specified by ci.
String str = rm.GetString("welcome", System.Globalization.CultureInfo.CurrentCulture);
Console.WriteLine(str);
}
}
The resource file must be written as the assembly name. The resource file name does not include the extension |
|