c# - Can I integrate container class methods with those of a generic interface? -


i have container class foo<tinterface> takes arbitrary interface type parameter , string "strcode" in constructor.

upon instantiating foo, strcode compiled via csharpcodeprovider and, through reflection, appropriate type located within newly compiled code, cast tinterface type , hoisted within foo property tinterface bar.

this works fine , client can access foo.bar no problem. however, foo contains (among other methods) method named recompile, takes , compiles new code string in aforementioned manner. works fine, means client ends foo api methods organised like:

foo.bar.makecoffee foo.bar.domagic foo.recompile 

i instead prefer:

foo.makecoffee foo.domagic foo.recompile 

in other words, return class instance top level access both generic interface methods , foo api methods.

ideally, nice return instance of foo<tinterface> understand c# generics not permit this. happy post code if required, first want make sure not barking wrong tree due c#'s static type nature.

i think have use proxy library castle dynamic proxy or linfu.

what goal trying achieve? want aop?


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -