这个字符串有什么问题?

vik*_*iky 2 c# string format

string.Format("{Find Name='{0}'}", name)
Run Code Online (Sandbox Code Playgroud)

它在运行时抛出异常,表示输入字符串格式错误.这个字符串有什么问题?

LBu*_*kin 12

你需要转义'{String.Format中的字符:

string.Format( "{{Find Name='{0}'}}", name )
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅以下内容

如何在.NET中的格式字符串中转义大括号(花括号)