c# - Get all images from a folder in my project/solution -


a quick question.

how in easiest , securest way images folder in solution without having copy them debug folder.

so lets folder structure:

project    resources (folder)        images (folder)           helpicons (folder)              icon1.png              icon2.png 

how icon1 , icon2 code? (without copy debug)

you can use getfiles directory specified.

string[] filenames = system.io.directory.getfiles("project\\resources\\images\\helpicons"); 

filenames contains list of filenames in directory, here can ".png"

--edit 12:13--

this starting directory executable is. can specify full path if needed.

string[] filenames = system.io.directory.getfiles("c:\\project\\resources\\images\\helpicons"); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -