Prototype.js Template to C# 3.0

Have you ever seen such syntax in JavaScript:

If you worked with great library Prototype.js surely yes. Such functionality implemented in class Template, which has just one method - evaluate. It does replacement in string template using input data object.

Now comes the tasty thing. How do you thing is it possible in C# 3.0? Of course yes! Let’s write the test (I expect you’ve heard about TDD):

Now we should implement Template class. Use a little bit reflection and we got prototype.js Template on C# 3.0.

Be happy of using it :)

In russian