c# - Optional extern interface implementation in dll -


i creating integration library accept various implementations of interfaces make run.

i have setup:

library

interface imodule {     void init();     } interface iexample : imodule {     void dosomething();     } class core {    iexample example {get; private set;} } 

core class looking each property of type imodule , each of type, based on external configuration assigns instance object implements interface of property type.

then have module meets requirements of core.

class myexamplemodule : iexample {    public void init() { }    public void dosomething() { }     public void examplefeature1() { }    public void examplefeature2() { } } 

i want close module myexamplemodule in .dll, , want run in environment w/o core , it's iexample , imodule interfaces. (i want 1 .dll, not 2 environments w/ , w/o interfaces).

is there way achieve in c#? if not (just curiosity reasons) there language in it's possible?

no, can't. clr needs assembly interfaces because needs know like. however, if you're concerned shipping 2 assemblies (why?) can merge them ilmerge. brings other problems , considerations though. going merge module core too? cause runtime exceptions.

i'm not aware of .net language can want. , in fact, doubt there's other language support interfaces aren't shipped implementing code.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -