I'm looking for how to create a collection of images from a directory and then instantiate all the images dynamically.
Actually I instantiate my images as follows:
private BitmapSource orange = BitmapUtil.FromImages("orange.png");
private BitmapSource lemon = BitmapUtil.FromImages("lemon.png");
private BitmapSource apple = BitmapUtil.FromImages("apple.png");
But the problem is that, let's say someone add new fruits in the directory that contains all these images of fruits. I want to instantiate all of these fruits dynamically so when we run the program, it checks for all the images in the folder /fruits/...
and then create this list of elements.
Edit: I want to do this using BitmapSource and BitmalUtil.FromImages because I still want to manipulate those images within a method. I don't want to store them randomly in a list.