Question: I have an 'Images' folder in the solution explorer. Can I create an enum list of all the images (& their paths). I want to add that list to a dropdown. For now I am doing this explicitly:

```
private enum bgImages
    {
        BlueArt,GreenArt,StripeArt
    }
protected void Page_Load(object sender, EventArgs e)
    {
      string[] Backgrounds = Enum.GetNames(typeof(bgImages));
      ddlBackground.DataSource = Backgrounds;
      ddlBackground.DataBind();
    }

 //..........
 pnlImage.BackImageUrl="~/Images/"+ddlBackground.SelectedItem.Text+".jpg";

```

Answer: 
use `Server.MapPath` with `Directory.GetFiles` to load the image names as below 

```
ddlBackground.DataSource = Directory.GetFiles(Server.MapPath("~/Images"), "*.jpg")
                 .Select(Path.GetFileNameWithoutExtension).ToList();

```

you can directly bind it to control.
Well, an enum has to be ready at compile time, so no.

What you can do however is use the Directory class to get all images in a folder.

```
Directory.GetFiles("[MyImagesPath]","*.jpg");

```

Will return the path of all files with the .jpg extension in the folder.

[More information can be found here](http://www.dotnetperls.com/directory-getfiles "More Information")