3 ms·
How can I use this structural typing feature? AOP weavers like postsharp let you do some duck typing like stuff by injecting interfaces as post compile step.
by agbell 16y ago
How can I use this structural typing feature?
AOP weavers like postsharp let you do some duck typing like stuff by injecting interfaces as post compile step.
- jared314 16y agoYou could try reflection and/or dynamic. The latter requires .Net 4.
- ecoffey 16y agoYou could use Reflection to search for types based on structure. But there is no syntax for it. Actually Linq + Reflection is some of the most entertaining code to write C#. Example: http://github.com/ecoffey/Bebop/blob/master/Bebop/BebopApplication.cs#L31 http://github.com/ecoffey/Bebop/blob/master/Bebop/BebopAppli... we're saying there "Give me all the types out of a specific assembly that implement IResource".