Accessing embedded resource files

To get a resource from the current assembly:

Stream stream = this.GetType().Assembly().GetManifestResourceStream("namespace.file");

To get all the names of all the resources in your current assembly:

string[] resources = this.GetType().Assembly.GetManifestResourceNames();
foreach(string resourceName in resources)
{
    Debug.WriteLine(resourceName);
}
Posted on 01 Mar 05 by Helen Emerson (last updated on 01 Mar 05).
Filed under .NET