Your html input line contained characters that are not allowed as String.Format()
arguments or you have another {
or }
in your input. For example, if input string will have something like “Name={0} value={1}” and you use String.Format()
passing only 1 value – you will get an exception.
One of solutions to use something more unique as replacement template, for example %%FirstName%% and use String.Replace instead.
var replaced = html.Replace("%%FirstName%%", firstName);
2
solved C# String.Format on stream reader [closed]