iT邦幫忙

0

調用 Properties.Resources 全域資源檔

有時候難免要使用一些資源檔
步驟分為 新增 & 使用

新增
在方案總管的專案上右鍵 選屬性
https://ithelp.ithome.com.tw/upload/images/20210223/20129372POJO11XX0s.png

再選資源
https://ithelp.ithome.com.tw/upload/images/20210223/20129372LiI2yHbopX.png

加入資源 我準備的是純文字的TXT檔
https://ithelp.ithome.com.tw/upload/images/20210223/20129372XQ9u29FryF.png

加好後 自動產生一個名為Resources的資料夾
https://ithelp.ithome.com.tw/upload/images/20210223/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();
        }
    }
}

結果如下
https://ithelp.ithome.com.tw/upload/images/20210223/20129372FhlNW6JSn7.png

結案

好像沒有用到 using System.Resources; 我也不知道為什麼


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言