List all embedded resources in a folder

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.


Try this, returns an array with all .txt files inside Folder directory.

private string[] GetAllTxt()
{
    var executingAssembly = Assembly.GetExecutingAssembly();
    string folderName = string.Format("{0}.Resources.Folder", executingAssembly.GetName().Name);
    return executingAssembly
        .GetManifestResourceNames()
        .Where(r => r.StartsWith(folderName) && r.EndsWith(".txt"))
        //.Select(r => r.Substring(folderName.Length + 1))
        .ToArray();
}

NOTE: Uncomment the //.Select(... line in order to get the filename.


have a try with this. here you get all files

string[] embeddedResources = Assembly.GetAssembly(typeof(T)).GetManifestResourceNames();

T is of course your type. so you can use it generic