Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explicit interface implementation and Reflection.Emit

Does anybody know how to implement an interface's property explicitly using Reflection.Emit?

like image 259
Apostolis Bekiaris Avatar asked Nov 20 '09 22:11

Apostolis Bekiaris


2 Answers

See the MSDN documentation for TypeBuilder.DefineMethodOverride, which includes an example of using Reflection.Emit to generate an explicit interface implementation using that method.

like image 189
kvb Avatar answered Oct 29 '22 01:10

kvb


This Reflector Addin should help you. It translates the IL code of a given method into the C# code that would be needed to generate the same IL code using System.Reflection.Emit.

like image 32
Mark Byers Avatar answered Oct 28 '22 23:10

Mark Byers