In short, I'd like to have a template that looks something like:
Dear @model.Firstname @model.Surname
I'd like to feed that into a method together with a prepopulated model like:
private String Transform(String Template, object model)
{
}
I then want to find all the places in the template starting with @ and replace it with the data contained in the supplied model.
The model would look something like:
public class Receipt
{
public String Firstname { get; set; }
public String Surname { get; set; }
...
I'm sure I should be able to get this done using reflection. How do I load the model object as a type of Model and then access the data it holds?
They do it in Razor, so I assume it must be possible.