C#C
C#4y ago
Warchortle

Creating a interface for a template engine for multiple different types

I created a very basic template engine to scan a string for a token and replace it. I am struggling to come up with an interface that can be used by various types to define what properties in it need to be passed through the template engine.

The idea was to create a base class that any object could inherit from and by calling a method on that class all of the string properties(or all the defined string properties) could be run through the template engine. But I cant find a good way to do that.

I looked into using reflection but wasn't able to get the value of the property. Any ideas on how to implement this, or on another approach.
Was this page helpful?