<legend id='Fij8n'><style id='Fij8n'><dir id='Fij8n'><q id='Fij8n'></q></dir></style></legend>

        <bdo id='Fij8n'></bdo><ul id='Fij8n'></ul>
    1. <i id='Fij8n'><tr id='Fij8n'><dt id='Fij8n'><q id='Fij8n'><span id='Fij8n'><b id='Fij8n'><form id='Fij8n'><ins id='Fij8n'></ins><ul id='Fij8n'></ul><sub id='Fij8n'></sub></form><legend id='Fij8n'></legend><bdo id='Fij8n'><pre id='Fij8n'><center id='Fij8n'></center></pre></bdo></b><th id='Fij8n'></th></span></q></dt></tr></i><div id='Fij8n'><tfoot id='Fij8n'></tfoot><dl id='Fij8n'><fieldset id='Fij8n'></fieldset></dl></div>
      1. <small id='Fij8n'></small><noframes id='Fij8n'>

        <tfoot id='Fij8n'></tfoot>

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

        时间:2023-05-20
      2. <small id='zaAmR'></small><noframes id='zaAmR'>

            1. <legend id='zaAmR'><style id='zaAmR'><dir id='zaAmR'><q id='zaAmR'></q></dir></style></legend>

              <tfoot id='zaAmR'></tfoot>
              <i id='zaAmR'><tr id='zaAmR'><dt id='zaAmR'><q id='zaAmR'><span id='zaAmR'><b id='zaAmR'><form id='zaAmR'><ins id='zaAmR'></ins><ul id='zaAmR'></ul><sub id='zaAmR'></sub></form><legend id='zaAmR'></legend><bdo id='zaAmR'><pre id='zaAmR'><center id='zaAmR'></center></pre></bdo></b><th id='zaAmR'></th></span></q></dt></tr></i><div id='zaAmR'><tfoot id='zaAmR'></tfoot><dl id='zaAmR'><fieldset id='zaAmR'></fieldset></dl></div>

                  <tbody id='zaAmR'></tbody>
                  <bdo id='zaAmR'></bdo><ul id='zaAmR'></ul>
                • 本文介绍了在 C# 中的字符串中找到 {0} 是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  在这样的字典中:

                  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"]);
                  

                  输出是:

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

                  For Key = "rtf" value = wordpad.exe

                  {0} 是什么意思?

                  推荐答案

                  您正在打印一个格式化的字符串.{0} 表示在格式字符串后面插入第一个参数;在这种情况下,与键rtf"关联的值.

                  You are printing a formatted string. The {0} means to insert the first parameter following the format string; in this case the value associated with the key "rtf".

                  对于 String.Format,如果你有类似的东西,这是相似的

                  For String.Format, which is similar, if you had something like

                  //            Format string                    {0}           {1}
                  String.Format("This {0}.  The value is {1}.",  "is a test",  42 ) 
                  

                  您将创建一个字符串This is a test.值为 42".

                  you'd create a string "This is a test. The value is 42".

                  您还可以使用表达式,并多次打印值:

                  You can also use expressions, and print values out multiple times:

                  //            Format string              {0} {1}  {2}
                  String.Format("Fib: {0}, {0}, {1}, {2}", 1,  1+1, 1+2) 
                  

                  yielding "Fib: 1, 1, 2, 3"

                  yielding "Fib: 1, 1, 2, 3"

                  在 http://msdn.microsoft.com/en-us 查看更多信息/library/txafckwd.aspx,讨论复合格式.

                  这篇关于在 C# 中的字符串中找到 {0} 是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:格式化 TimeSpan 大于 24 小时 下一篇:自定义数字格式字符串以始终显示符号

                  相关文章

                • <i id='vMEAD'><tr id='vMEAD'><dt id='vMEAD'><q id='vMEAD'><span id='vMEAD'><b id='vMEAD'><form id='vMEAD'><ins id='vMEAD'></ins><ul id='vMEAD'></ul><sub id='vMEAD'></sub></form><legend id='vMEAD'></legend><bdo id='vMEAD'><pre id='vMEAD'><center id='vMEAD'></center></pre></bdo></b><th id='vMEAD'></th></span></q></dt></tr></i><div id='vMEAD'><tfoot id='vMEAD'></tfoot><dl id='vMEAD'><fieldset id='vMEAD'></fieldset></dl></div>
                  <legend id='vMEAD'><style id='vMEAD'><dir id='vMEAD'><q id='vMEAD'></q></dir></style></legend>

                    • <bdo id='vMEAD'></bdo><ul id='vMEAD'></ul>

                    <small id='vMEAD'></small><noframes id='vMEAD'>

                      <tfoot id='vMEAD'></tfoot>