Simple Templating in C#

Hi Kids!

Here is a simple templating Sample and replacing placeholders in C#

StringBuilder str = new StringBuilder();          
string temp = "";

foreach (Item item in items)
     temp = Template.Text;    
     StringBuilder strTemplace = new StringBuilder(temp);
     strTemplace.Replace("{title}", item.title);
     strTemplace.Replace("{url}", item.url);
     strTemplace.Replace("{location}", item.location);

Alright Kids!

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *