Как читать встроенный ресурсный текстовый файл

Как прочитать встроенный ресурс (текстовый файл), используя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();
}

Ответы на вопрос(17)

Ваш ответ на вопрос