{"id":227,"date":"2010-09-30T11:52:46","date_gmt":"2010-09-30T11:52:46","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=227"},"modified":"2010-09-30T11:52:46","modified_gmt":"2010-09-30T11:52:46","slug":"net-%e4%b8%ad%e7%9a%84%e6%95%b0%e5%ad%97%e6%a0%bc%e5%bc%8f%e5%8c%96%ef%bc%8c%e6%97%a5%e6%9c%9f%e6%a0%bc%e5%bc%8f%e5%8c%96","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/09\/30\/net-%e4%b8%ad%e7%9a%84%e6%95%b0%e5%ad%97%e6%a0%bc%e5%bc%8f%e5%8c%96%ef%bc%8c%e6%97%a5%e6%9c%9f%e6%a0%bc%e5%bc%8f%e5%8c%96\/","title":{"rendered":".NET \u4e2d\u7684\u6570\u5b57\u683c\u5f0f\u5316\uff0c\u65e5\u671f\u683c\u5f0f\u5316"},"content":{"rendered":"<p>1,\u57fa\u672c\u5185\u5bb9\u662f\uff1a\u53ef\u4ee5\u5728 Console.WriteLine\uff08\u4ee5\u53ca String.Format\uff0c\u5b83\u88ab Console.WriteLine \u8c03\u7528\uff09\u4e2d\u7684\u683c\u5f0f\u5b57\u7b26\u4e32\u5185\u7684\u62ec\u53f7\u4e2d\u653e\u5165\u975e\u7d22\u5f15\u6570\u5b57\u7684\u5185\u5bb9\u3002<br \/>\n\u683c\u5f0f\u89c4\u8303\u7684\u5b8c\u6574\u5f62\u5f0f\u5982\u4e0b\uff1a<br \/>\n{index [, width][:formatstring]}<br \/>\n\u5176\u4e2d\uff0cindex \u662f\u6b64\u683c\u5f0f\u7a0b\u5e8f\u5f15\u7528\u7684\u683c\u5f0f\u5b57\u7b26\u4e32\u4e4b\u540e\u7684\u53c2\u6570\uff0c\u4ece\u96f6\u5f00\u59cb\u8ba1\u6570\uff1bwidth\uff08\u5982\u679c\u6709\u7684\u8bdd\uff09\u662f\u8981\u8bbe\u7f6e\u683c\u5f0f\u7684\u5b57\u6bb5\u7684\u5bbd\u5ea6\uff08\u4ee5\u7a7a\u683c\u8ba1\uff09\u3002width \u53d6\u6b63\u6570\u8868\u793a\u7ed3\u679c\u53f3\u5bf9\u9f50\uff0c\u53d6\u8d1f\u6570\u5219\u610f\u5473\u7740\u6570\u5b57\u5728\u5b57\u6bb5\u4e2d\u5de6\u5bf9\u9f50\u3002formatstring \u662f\u53ef\u9009\u9879\uff0c\u5176\u4e2d\u5305\u542b\u6709\u5173\u8bbe\u7f6e\u7c7b\u578b\u683c\u5f0f\u7684\u683c\u5f0f\u8bf4\u660e.<br \/>\n2,\u6570\u5b57\u683c\u5f0f<br \/>\n\u8bf7\u6ce8\u610f\uff0c\u6570\u5b57\u7684\u683c\u5f0f\u662f\u533a\u5206\u8bed\u8a00\u7684\uff1a\u5206\u9694\u7b26\u4ee5\u53ca\u5206\u9694\u7b26\u4e4b\u95f4\u7684\u7a7a\u683c\uff0c\u8fd8\u6709\u8d27\u5e01\u7b26\u53f7\uff0c\u90fd\u662f\u7531\u8bed\u8a00\u51b3\u5b9a\u7684 ? \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u662f\u60a8\u8ba1\u7b97\u673a\u4e0a\u7684\u9ed8\u8ba4\u8bed\u8a00\u3002\u9ed8\u8ba4\u8bed\u8a00\u4e0e\u6267\u884c\u7ebf\u7a0b\u76f8\u5173\uff0c\u53ef\u4ee5\u901a\u8fc7 Thread.CurrentThread.CurrentCulture \u4e86\u89e3\u548c\u8bbe\u7f6e\u8bed\u8a00\u3002\u6709\u51e0\u79cd\u65b9\u6cd5\uff0c\u53ef\u4ee5\u4e0d\u5fc5\u4ec5\u4e3a\u4e00\u79cd\u7ed9\u5b9a\u7684\u683c\u5f0f\u64cd\u4f5c\u5c31\u7acb\u5373\u66f4\u6539\u8bed\u8a00\u3002<br \/>\n\u5185\u7f6e\u7c7b\u578b\u7684\u5b57\u6bcd\u683c\u5f0f<br \/>\n\u6709\u4e00\u79cd\u683c\u5f0f\u547d\u4ee4\u4ee5\u5355\u4e2a\u5b57\u6bcd\u5f00\u5934\uff0c\u8868\u793a\u4e0b\u5217\u8bbe\u7f6e\uff1a<br \/>\nG?\u5e38\u89c4\uff0cE \u6216 F \u4e2d\u8f83\u77ed\u7684<br \/>\nF?\u6d6e\u70b9\u6570\uff0c\u5e38\u89c4\u8868\u793a\u6cd5<br \/>\nE?\u7528 E \u8868\u793a\u6cd5\u8868\u793a\u7684\u6d6e\u70b9\u6570\uff08\u5176\u4e2d\uff0cE \u4ee3\u8868 10 \u7684\u6b21\u5e42\uff09<br \/>\nN?\u5e26\u6709\u5206\u9694\u7b26\u7684\u6d6e\u70b9\u6570\uff08\u5728\u7f8e\u56fd\u4e3a\u9017\u53f7\uff09? \u5982:N4 \u4ee3\u8868\u53d6\u56db\u4f4d\u5c0f\u6570<br \/>\nC?\u8d27\u5e01\uff0c\u5e26\u6709\u8d27\u5e01\u7b26\u53f7\u548c\u5206\u9694\u7b26\uff08\u5728\u7f8e\u56fd\u4e3a\u9017\u53f7\uff09<br \/>\nD?\u5341\u8fdb\u5236\u6570\uff0c\u4ec5\u7528\u4e8e\u6574\u578b<br \/>\nX?\u5341\u516d\u8fdb\u5236\u6570\uff0c\u4ec5\u7528\u4e8e\u6574\u578b<\/p>\n<p>double pi = Math.PI;<br \/>\ndouble p0 = pi * 10000;<br \/>\nint i = 123;<\/p>\n<p>Console.WriteLine(&#8220;pi, G4?? {0, 25:G4}&#8221;, pi); \/\/???????????????????? 3.142<\/p>\n<p>Console.WriteLine(&#8220;pi, G4?? {0, 25:G4}&#8221;, pi); \/\/???????????????????? 3.142<\/p>\n<p>Console.WriteLine(&#8220;i,? D7?? {0, 25:D7}&#8221;, i ); \/\/?????????????????? 0000123<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1,\u57fa\u672c\u5185\u5bb9\u662f\uff1a\u53ef\u4ee5\u5728 Console.WriteLine\uff08\u4ee5\u53ca String.Format\uff0c\u5b83\u88ab Conso [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-227","post","type-post","status-publish","format-standard","hentry","category-csharp"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}