Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In my solution a had a folder with a few files. All this files have the Build Action "Embedded Resource".

With this code I can get a file:

assembly.GetManifestResourceStream(assembly.GetName().Name + ".Folder.File.txt");

But is there any way to get all *.txt files in this folder? A list of names or a method to iterate through them all?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
321 views
Welcome To Ask or Share your Answers For Others

1 Answer

You could check out

assembly.GetManifestResourceNames()

which returns an array of strings of all the resources contained. You could then filter that list to find all your *.txt files stored as embedded resources.

See MSDN docs for GetManifestResourceNames for details.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...