MSIL: overriding explicit interface member?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know its not possible to override explicit interface declarations in a
subclass.

But is it doable in MSIL?

what I need to do is to create runtime proxies for different IList
implementations.
which currently work just fine for implicit virtual declarations.

the problems with the explicit declarations is that they are (in the ilcode)
"private"
which makes my typebuilder throw up on me saying "method access exception"
which I do understand why.

but I just wanted to make sure if there is any way to accomplish this in msil?

my current idea is to call teh private member through methodinfo.invoke ,
but that is slow and id rather find another way to do it..

//Roger
 
I am not sure I understand what you are trying to accomplish here, the "why"
rather than the "what", so my comments may be a bit off track.

In a the object hierarchies I have built, I see no reason to do what you are
suggesting. As such, my first inclination is to step back and take a look at
the base and derived classes and make sure you have a good inheritance model.
If you can answer yes to the question of inheritance, I would determine
whether the issue is strong enough to poke at IL versus capturing metadata
and creating a code generator for the derived classes.

As for your IL question, I do not know, but I would venture a guess that the
answer is "no", as it would kludge up the system. While you may not see it
this way, the question is: If you are Microsoft, and you open this box, how
far do you go in opening private members?


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
the "why" is very simple , we need our ormapper framework to be able to
create runtime proxies for various types , everything works just fine when
dealing with public virtual members.

however , we also need to inject interceptor code into list classes
(developed by 3rd party) those lists may or may not have the IList interface
declared explicit.
if they implement the ilist interface implicit with public virtual members ,
everything works fine and we can inject interceptors in the subclassed
proxies...

the problems starts when the 3rd party implements the ilist interface
explicitly , which is most likely the case when creating a typed list or such.
in that case we need to re-implement the ilist interface in the runtime
proxy , and make the re-implemented method call the original method..

as its seems right now we will need to do this with methodinfo.invoke

//Roger
 
Back
Top