第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何讀取嵌入式資源文本文件

如何讀取嵌入式資源文本文件

繁星點點滴滴 2019-06-04 17:29:21
如何讀取嵌入式資源文本文件如何使用StreamReader并以字符串的形式返回?當前腳本使用Windows窗體和文本框,允許用戶在未嵌入的文本文件中查找和替換文本。private void button1_Click(object sender, EventArgs e){     StringCollection strValuesToSearch = new StringCollection();     strValuesToSearch.Add("Apple");     string stringToReplace;     stringToReplace = textBox1.Text;     StreamReader FileReader = new StreamReader(@"C:\MyFile.txt");     string FileContents;     FileContents = FileReader.ReadToEnd();     FileReader.Close();     foreach (string s in strValuesToSearch)     {         if (FileContents.Contains(s))             FileContents = FileContents.Replace(s, stringToReplace);     }     StreamWriter FileWriter = new StreamWriter(@"MyFile.txt");     FileWriter.Write(FileContents);     FileWriter.Close();}
查看完整描述

3 回答

?
滄海一幻覺

TA貢獻1824條經(jīng)驗 獲得超5個贊

當您將該文件添加到資源中時,您應(yīng)該選擇其Access Modifier為public,這樣您就可以創(chuàng)建如下所示的內(nèi)容。

byte[] clistAsByteArray = Properties.Resources.CLIST01;

CLIST 01是嵌入文件的名稱。

實際上,您可以轉(zhuǎn)到Resourcees.Designer.cs,看看getter的名稱是什么。


查看完整回答
反對 回復(fù) 2019-06-04
  • 3 回答
  • 0 關(guān)注
  • 762 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號