For sending email I am using the IsBodyHtml attribute. In the html text I am replacing variables with place holders like {0} {1}. But the html file already contains some data inside {} as style. So when I am using String.Format method its throwing error.
So how to handle that part coming under {} as I am also using place holders as {0}, {1} etc.
You can have your style in separate variable and body in a separate variable. Use the String.Format in the second variable. and append it to first variable.
I have an html file. In that file I have replaced all the variable part with place holders. Then I am reading the whole text from that file and storing in a string variable. Then using String.Format method passing the string variable and giving the values. But in that text itself already {} is used in html style which is throwing error as incorrect format exception.
If the string already contains { or }, you would need to use something else. It’s cumbersome, but you could use different delimiters and the Replace function. For instance, if MyString = "Hello! My name is ~0~ ~1~, and I am ~2~ years old.":