Reputation: 39524
I am loading a resource from the current assembly as follows:
var a = Assembly.GetExecutingAssembly();
using (StreamReader str = new StreamReader(a.GetManifestResourceStream("AS.S.sql"))) {
}
However I need to read 20 files from the assembly and convert each stream to Byte[].
What is the best way to do this?
Thank You, Miguel
Upvotes: 0
Views: 134
Reputation: 39524
I was able to solve this:
Assembly a = Assembly.GetExecutingAssembly();
foreach (String f in a.GetManifestResourceNames()) {
using (StreamReader stream = new StreamReader(a).GetManifestResourceStream(f))) {
var file = stream.BaseStream.ToByte();
}
}
Thank You, Miguel
Upvotes: 1