弘帝企业智能建站系统交流平台

 找回密码
 立即注册
查看: 339|回复: 0

资源的使用两种方案

[复制链接]
发表于 2023-11-4 21:51:22 | 显示全部楼层 |阅读模式
第一种:Resources.Global.init;
第二种:
ResourceManager rm = new ResourceManager("Hondy.Site.App_GlobalResources.Global", typeof(Global).Assembly);
return rm.GetString("init");
注意事项:
这儿Resources是在命名空间根,实际资源文件在路径为Hondy.Site.App_GlobalResources根目录下App_GlobalResources下。
Global为默认资源文件,Global.resx,不用管Global.zh-cn.resx国别文件。
捷径思路:
可以查看Global.desinger.cs代码行,进行修改
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Hondy.Site.App_GlobalResources.Global", typeof(Global).Assembly);
下面几种错误的写法:
ResourceManager rm = new ResourceManager("Resources", typeof(Global).Assembly);
ResourceManager rm = new ResourceManager( typeof(Resources.Global).Assembly);
ResourceManager rm = new ResourceManager("Resources.Global");

首次应用Hondy.Site.API.Login.Chat.Index--->GetBtns()




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|弘帝企业智能建站系统 ( 皖ICP备07503252号 )

GMT+8, 2024-4-27 22:17 , Processed in 0.056149 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表