static void Main(string[] args)
{
IDictionary<string, string> placeHolder = new Dictionary<string, string>();
placeHolder.Add("#FirstName#","Phil");
placeHolder.Add("#MiddleName#", "J");
placeHolder.Add("#LastName#", "Haack");
string parsedXmlString=GetParsedTemplate(@"
#FirstName#
#MiddleName#
#LastName#
{
IDictionary<string, string> placeHolder = new Dictionary<string, string>();
placeHolder.Add("#FirstName#","Phil");
placeHolder.Add("#MiddleName#", "J");
placeHolder.Add("#LastName#", "Haack");
string parsedXmlString=GetParsedTemplate(@"
", placeHolder);}
public static string GetParsedTemplate(string wellFormedXML, IDictionary<string, string> placeHolder)
{
placeHolder.AsEnumerable().ToList().ForEach(t => wellFormedXML = wellFormedXML.Replace(t.Key, t.Value));
return wellFormedXML;
}
No comments :
Post a Comment