So what I want to do is write an application that uses one of two external libraries, sometimes using the first and sometimes using the second. Both of these libraries are quite big, so ideally I'd only include the one that is needed, or build two versions of the app, one with the first library and one with the second.
Currently my approach is to have all the relevant code using said library each in it's own class, then put those classes into their own .dll file and access it via reflection during runtime. That way, I can "ship" this with only the singular .dll file that is needed.
Are there better ways? Reflection seems a bit like a pain when it comes to readability and reliability. So far I've thought about preprocessing directives (can I just exclude the entire class using one of the libraries and hopefully the library too?) and dependency injection (this came up during my search but I have never worked with it so I don't know if this will be helpful).