I am learning to use polymorphism in C#, but cannot figure out this one. I’m trying to write a class that allows me to get a filtered list of files from a repository.
The repository could be a file system folder or the embedded resources in an arbitrary already-loaded assembly (but it is not the one currently executing).
Any suggestions?
You could define pair of interfaces like this:
And have two different implementations of them:
And then you can write your algorithms dependant on only these interfaces and not on their implementations.