I have a library that is used in a wpf mef application. Included in this library are a number of files. One of them is app.js.
How do I read app.js from the library as a string.
PS: From an earlier code, I can access/create a bitmap image using the code below:
private readonly BitmapImage _starImageSmall = new BitmapImage(new Uri("pack://application:,,,/MyFirstExtension;component/Star_16x16.png", UriKind.Absolute));
After generating the Uri, how do I get access to the stream as the system stream?
This block of code has never failed me:
Three things to note with this code block:
Assembly.GetExecutingAssembly()), not the calling assembly or any other assembly; change it to suit your needs (see below for alternative)resourceNameshould be the filename only (e.g. If your file is saved atresources/myRes.bin, you callGetEmbeddedResourceStream("myRes.bin")If, however, you want the code to work on arbitrary assemblies, you can change the code block to: