• C# 读取resource文件


                ResourceManager fileText = null;
                string path = "ResourceCon.test.Language";
                fileText = new ResourceManager(path, typeof(Test).Assembly);
                string res = fileText.GetString("PortalSettingKey_hisBoxFocus", new CultureInfo("en")); //new CultureInfo("zh-CN")

    上面代码中ResourceCon为类库名。Test为类库下的一个文件。需要在类库下建一个test文件夹。放置两个资源文件ResCon.test.Language.resources和ResCon.test.Language.zh-CN.resources

    ResourceManager构造函数表示在集合里查找含有path名称的resource文件
    GetString方法表示指定语言查找key对应值
    记录编程的点滴,体会学习的乐趣
  • 相关阅读:
    遍历二维数组
    冒泡跟扫描共用
    1.8作业
    1.7作业
    1.5作业
    百文百鸡 水仙花数 百马百担
    for循环输出九九乘法表
    循环语句
    1.4作业
    07、找出1-99之间的同构数
  • 原文地址:https://www.cnblogs.com/AduBlog/p/14819485.html
Copyright © 2020-2023  润新知