1. 程式人生 > >.Net MVC中使用資原始檔

.Net MVC中使用資原始檔

1.1.在Supcon.Mes.CustomDemo.Web專案中使用資原始檔,資原始檔也在此專案中

1.2.注:資原始檔的Build Action屬性:Embedded Resource Assembly assembly = Assembly.GetExecutingAssembly(); ResourceManager rm = new ResourceManager("Supcon.Mes.CustomDemo.Web.Localization.source.TestEn-zh-CN", assembly);

ResourceManager rm = new ResourceManager("名稱空間.資原始檔名",資原始檔所在的程式集);

2.1.在Demo專案中呼叫Supcon.Mes.CustomDemo.Web專案中的資原始檔

2.2.引入Supcon.Mes.CustomDemo.Web.dll

ResourceManager rm = new ResourceManager("Supcon.Mes.CustomDemo.Web.Localization.source.TestEn-zh-CN",typeof(Supcon.Mes.CustomDemo.Web.Controllers.HomeController).Assembly); string s = rm.GetString("start"); //s("開始")

ResourceManager rm = new ResourceManager("名稱空間.資原始檔名",資原始檔所在的程式集);