|
发表于 2020-6-24 13:45:01
|
显示全部楼层
使用资源文件using ResourceManager
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);
}
}
资源文件必须写成,程序集名字.资源文件名不包括扩展名
|
|