c# - How to get all images in the resources as list? -
i have winforms project , added multiple images resources (project properties -> resources). have form1.cs, usercontrol1.cs .resx files, , using assembly.getmanifestresourcenames()
, contains 3 strings namely:
1 testapplication1.properties.resources.resources, 2 testapplication1.form1.resources 3 testapplication1.usercontrol1.resources
what need files #1 contains images need get. need have list can access these images through indexes. can access files individually no problem, have 72 images need them list. question is, how these images in #1 list?
edit: there no other way create list , add of 72 images it? or there way can of these images resources list? also, don't want resort using system.io
build application class library.
each .resx
file compiled single "composite" embedded *.resources
resource blob located in assembly. appreciate confusing means term "resource" overloaded refer both .resources
blob, individual contents of each blob.
use resourcemanager
class retrieve named items within .resources
file.
note if you're using .resx
designer in visual studio don't need use resourcemanager
directly, use generated resources
class, so:
using myproject.properties; ... this.label1.text = resources.somelabeltext;
(where somelabeltext
key name)
by default, designer-generated resources
class under properties
child namespace.
to enumerate resources you'll need use resourcemanager
, so:
resourceset rsrcset = myproject.properties.resources.resourcemanager.getresourceset( cultureinfo.currentculture, false, true ); foreach( dictionaryentry entry in rsrcset ) { string name = entry.key; object resource = entry.value; }
Comments
Post a Comment