Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Image resources can be added to an assembly in a couple of different ways, that will have some impact on the code to enumerate the image names.</p> <ul> <li>You can add images to a resx file.</li> <li>You can add the images directly to the solution (as with your code files), and set their build action to 'Embedded Resource'.</li> </ul> <p>The code sample that you supplied in your question will work in the second case. Note however that it will also list any other manifest resources (such as embedded resx files) and not just your images.</p> <p>If you have added the images to a resx file you can enumerate resources using a <a href="http://msdn.microsoft.com/en-us/library/system.resources.resourceset.aspx" rel="nofollow noreferrer"><code>ResourceSet</code></a> obtained from a <a href="http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx" rel="nofollow noreferrer"><code>ResourceManager</code></a>:</p> <pre><code>// This requires the following using statements in the file: // using System.Resources; // using System.Collections; ResourceManager rm = new ResourceManager(typeof(Images)); using (ResourceSet rs = rm.GetResourceSet(Thread.CurrentThread.CurrentUICulture, true, true)) { IDictionaryEnumerator resourceEnumerator = rs.GetEnumerator(); while (resourceEnumerator.MoveNext()) { if (resourceEnumerator.Value is Image) { Console.WriteLine(resourceEnumerator.Key); } } } </code></pre> <p>In the first line, where it says <code>ResourceManager(typeof(Images))</code>, you will need to exchange <code>Images</code> with the name of the resource file i which your images are located (in my sample, it was called "Images.resx").</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload