.Net assemblies not only contain code, it can also have other resource files. e.g. text files or binary image files. When compile an assemble, these files are wrapped into the dll or exe assemble file.
How to access these files from application code? Here is an example of retrieving an javascript file that is wrapped in an assembly.
Stream stream = typeof(anthem.Manager).Assembly.GetManifestResourceStream("Anthem.Anthem.js");
StreamReader sr = new StreamReader(stream);
string result = sr.ReadToEnd();
We can see that the javascript file is in the assembly where the class
anthem.Manager is declared. "typeof" operator returns a System.Type object that has all associated information with that type.
No comments:
Post a Comment