I have a string.
This string is extracted from a file at runtime and can be anything with it's format being the one in the example below.
The only rule is that words inside brackets have to be converted to properties on a dynamic object and it's values asked from the user, probably by using a winforms PropertyGrid or an ObjectListView. The user's answers will then be merged into the string template (maybe using FormattableStringFactory.Create ?).
Example strings:
string template = "The client name is {name} and the client's age is {age}";
string template2 = "This house is on {streetName} and the door number is {doorNumber}";
Object extraction:
dynamic templateObject = objectExtractor (templateString);
Final string (after data is introduced into the templateObject by the user):
string result = "The client name is John and the client's age is 25";
In other words, what i want to do is similar to what C# 6 compiler does with it's string interpolation syntactic sugar.
I'm looking for a way (a simple generic one, preferably) to do it but i can't figure it out myself and haven't found it after some extensive googling.