article

Generating code using T4 templates

Recently I was updating a library that contains two keyed collection classes. These collections aren't the usual run-of-the-mill collections as they need to be able to support duplicate keys. Normally I'd inherit from `KeyedCollection` but as with most collection implementations, duplicate keys are not permitted in this class. This article describes how I used T4 templates to dynamically generate my custom collection classes without requiring a public base class.

avatar
Richard Moss