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
I wanted to read the embedded resource just as a byte array (without assuming any specific encoding), and I ended up using a MemoryStream
which makes it very simple:
using var resStream = assembly.GetManifestResourceStream(GetType(), "file.txt");
var ms = new MemoryStream();
await resStream .CopyToAsync(ms);
var bytes = ms.ToArray();