List of all files that are inside the Resource.Raw folder

1

How to get all the files that are in the Resource folder and move to a list.

I'm doing it manually, but now I need to dynamically pick up and move to a list all the files that are in the Resource.Raw folder

string[] caminho = new string[2];
caminho[0] = "android.resource://" + PackageName + "/" + Resource.Drawable.a;
caminho[1] = "android.resource://" + PackageName + "/" + Resource.Drawable.b;
    
asked by anonymous 26.01.2018 / 03:28

1 answer

0

Something like this could solve:

var files = Directory.GetFiles("android.resource://" + PackageName + "/", "*.*")
            .Where(s => s.EndsWith(".mp4"));
var caminho = new List<string>();
foreach (var item in files)
{
     caminho.Add("android.resource://" + PackageName + "/" + item);
}
  • Directory to get all files in your directory (change as necessary).
  • Foreach to populate a list of your files.
26.01.2018 / 16:20