Setting a file's Build Action to Embedded Resource in Visual Studio causes the file to be embedded in the assembly, but it's
not obvious how to actually access the file's data. A
Stream for a given resource can be acquired through the
GetManifestResourceStream function on an assembly, most likely
Assembly.GetExecutingAssembly() for the current one. The resource name is qualified by the root namespace, so a project with a root namespace of SomeProgram with an embedded file named
TheDocument.txt would find that file at
SomeProgram.TheDocument.txt.
No comments:
Post a Comment