相关疑难解决方法(0)

在C#中的字符串中找到{0}是什么意思?

在这样的字典中:

Dictionary<string, string> openWith = new Dictionary<string, string>();

openWith.Add("txt", "notepad.exe");
openWith.Add("bmp", "paint.exe");
openWith.Add("dib", "paint.exe");
openWith.Add("rtf", "wordpad.exe");

Console.WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]);
Run Code Online (Sandbox Code Playgroud)

输出是:

对于Key ="rtf"value = wordpad.exe

什么{0}意思?

c# string formatting

81
推荐指数
5
解决办法
22万
查看次数

标签 统计

c# ×1

formatting ×1

string ×1