Using embedded resources in .NET

To use an embedded resource, add the file to a project, then mark it as "embedded resource"



If the file location is at "Resources\filename.png", then to access it from code use this:

typeof(MyClass).Assembly.GetManifestResourceStream("MyNamespace.Resources.filename.png")

Or you can list all of them by calling:

typeof(MyClass).Assembly.GetManifestResourceNames()

Post a Comment

Previous Post Next Post