0

I'm trying to modularize a part of my codebase in c# by creating a pure interface class library. Then in my main application I would like to dynamically load a dll which will depend on a user choice. This dll should implement the entirety of the mentioned interface class library.

I'm rusty when it comes to c# and don't really know how to do it properly here.

Right now I'm statically linking one implementation of named class library in the main program but would as I said like the dll files in my extensions folder to load it entirely dynamically. Like a true extension should do.

  public interface ISomeInterface {
    int CalculateSomethingNice();
    bool Load();
    bool Save();
  }

Let's say I want two implementations of all interfaces that are in my library, in this example it only has ISomeInterface, in two separate projects, which might not be accessible in my solution, Extension1 and Extension2 (at later stage loaded with: extension1.dll and extension2.dll)

How is this done properly in c#?

[Edit] I found three great blog posts that fit my use-case like a glove so sharing it here in case someone else needs a similar introduction:

Decaf Sux
  • 305
  • 1
  • 11

0 Answers0