In my application I compile another program from source.cs file using CodeDom.Compiler and I embed some resources ( exe and dll files ) at compile time using :
Simple alternative using a MemoryStream:
MemoryStream
var ms = new MemoryStream(); await resFilestream.CopyToAsync(ms); var bytes = ms.ToArray();