How do I read an embedded resource (text file) using StreamReader and return it as a string? My current script uses a Windows form and textbox that allows the
StreamReader
You can also use this simplified version of @dtb's answer:
public string GetEmbeddedResource(string ns, string res) { using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(string.Format("{0}.{1}", ns, res)))) { return reader.ReadToEnd(); } }