04 Aug

Extending Marker Interfaces

In Volume II, Part VII, I use Yan Cui’s (@theburningmonk) concept of Marker Interfaces for “concatenating” unions (pp 86). The intent therein is to permit the user to “extend” the nature of the information that the ETW logging/instrumentation processes will log – although, the principle is useful in allowing a developer to “extend” any suitable marked-up union defined in a referenced assembly.

For other purposes I’ve reviewed this principle and now have found the method whereby it’s possible to extend the marker interface by adding properties and methods that will be automatically available to any user-defined union that implements a core defined marker interface. The method is depicted via three source files with an accompanying test script in the following image – note that I’m now using F#4.1 with .NET Framework 4.7 in the 2017 Community Edition of Visual Studio.

Extending Marker Interfaces - Source Code

Extending Marker Interfaces – Source Code

Leave a Reply

Contact Form

Contact Form

You may use this form to send me an email…
Click on the panel tab or elsewhere on the screen to close this panel.