调用 Properties.Resources 全域资源档

有时候难免要使用一些资源档
步骤分为 新增 & 使用

新增
在方案总管的专案上右键 选属性
http://img2.58codes.com/2024/20129372POJO11XX0s.png

再选资源
http://img2.58codes.com/2024/20129372LiI2yHbopX.png

加入资源 我準备的是纯文字的TXT档
http://img2.58codes.com/2024/20129372XQ9u29FryF.png

加好后 自动产生一个名为Resources的资料夹
http://img2.58codes.com/2024/20129372ek9AuFy9RA.png


using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Resources_test_2{    class Program    {        static void Main(string[] args)        {            Console.WriteLine(Properties.Resources.GN25L96_A2_table2);            Console.ReadLine();        }    }}

结果如下
http://img2.58codes.com/2024/20129372FhlNW6JSn7.png

结案

好像没有用到 using System.Resources; 我也不知道为什么


关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章