string.Format("{Find Name='{0}'}", name)
it throws Exception at runtime saying input string was in wrong format. What is wrong in this string?
You need to escape the '{ characters in String.Format:
string.Format( "{{Find Name='{0}'}}", name )
See the following for more details:
How to escape braces (curly brackets) in a format string in .NET
Curly braces have a special meaning in formatting strings, and thus need to be escaped. Simply double the literal braces from { to {{ and } to }}:
string.Format("{{Find Name='{0}'}}", name)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With