Posted: 5 years ago

Filed under: .NET

Tagged with: c# controls webresource

Follow comments

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);
}

Leave a Reply