{"id":567,"date":"2023-09-16T17:16:01","date_gmt":"2023-09-16T09:16:01","guid":{"rendered":""},"modified":"2023-09-17T00:41:33","modified_gmt":"2023-09-16T16:41:33","slug":"c%e5%ad%97%e7%ac%a6%e4%b8%b2%e8%bd%ac%e6%95%b0%e7%bb%84%ef%bc%8c%e6%95%b0%e7%bb%84%e8%bd%ac%e5%ad%97%e7%ac%a6%e4%b8%b2%ef%bc%8c%e5%90%8e%e9%81%8d%e5%8e%86%e6%95%b0%e7%bb%84","status":"publish","type":"post","link":"https:\/\/mushiming.com\/567.html","title":{"rendered":"C#\u5b57\u7b26\u4e32\u8f6c\u6570\u7ec4\uff0c\u6570\u7ec4\u8f6c\u5b57\u7b26\u4e32\uff0c\u540e\u904d\u5386\u6570\u7ec4"},"content":{"rendered":"
string ids=\"5,1,6,3,5,7,8,9,1,5,6,\"
var temp = ids.Split(\",\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(a=>a.ToInt()).ToArray();
==>temp=[5,1,6,3,5,7,8,9,1,5,6]<\/p>\n
\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p>\n
string str = \"1,2,3,4,5,6,7\";
string[] strArray = str.Split(','); \/\/\u5b57\u7b26\u4e32\u8f6c\u6570\u7ec4
str = string.Empty;
str = string.Join(\",\", strArray);\/\/\u6570\u7ec4\u8f6c\u6210\u5b57\u7b26\u4e32<\/p>\n
\/\/\u58f0\u660e\u6570\u7ec4. \u7b2c\u4e00\u79cd\u65b9\u6cd5. \u58f0\u660e\u5e76\u5206\u914d\u5143\u7d20\u5927\u5c0f.\n13 int[] Myint = new int[30];\n14 Myint[0] = 30;\n15 Myint[1] = 50;\n16 \/\/ \u4ee5\u6b64\u7c7b\u63a8, \u8d77\u59cb\u4e0b\u6807\u4e3a0\n17 \/\/-------------------------------\n18 \/\/ \u58f0\u660e\u6570\u7ec4,\u7b2c\u4e8c\u79cd\u65b9\u6cd5, \u58f0\u660e\u5e76\u76f4\u63a5\u8d4b\u503c,\u6ca1\u6709\u6307\u5b9a\u5143\u7d20\u5927\u5c0f.\n19 int[] Myint1 = { 20,10,50,65,18,90}; \n20 \/\/------------------------------------------\n21 \/\/\u58f0\u660e\u6570\u7ec4,\u7b2c\u4e09\u79cd\u65b9\u6cd5, \u58f0\u660e\u5e76\u5206\u914d\u5927\u5c0f,\u4e14\u8d4b\u503c.\n22 int[] i = new int[5] { 10, 20, 30, 40, 50 };\n23 \n24 \/\/ -----------------------------------------------\n25 \/\/ foreach\u5faa\u73af\u904d\u5386\u6570\u7ec4..\n26 int[] Sum = new int[50];\n27 Random rd = new Random();\n28 \/\/ \u5148\u7528for\u5faa\u73af\u7ed9\u6570\u7ec4\u53d6\u968f\u673a\u6570.\n29 for (int s = 0; s <= Sum.Length - 1; s++) \/\/ Sum.Length\u662f\u6570\u7ec4\u7684\u4e00\u4e2a\u5c5e\u6027,Length\u4ee3\u8868\u6570\u7ec4\u7684\u957f\u5ea6\n30 {\n31 Sum[s] = rd.Next(100);\n32 }\n33 \/\/ \u904d\u5386\u6570\u7ec4\u8f93\u51fa\n34 foreach (int t in Sum)\n35 {\n36 Console.WriteLine(t);\n37 }<\/pre>\n","protected":false},"excerpt":{"rendered":"C#\u5b57\u7b26\u4e32\u8f6c\u6570\u7ec4\uff0c\u6570\u7ec4\u8f6c\u5b57\u7b26\u4e32\uff0c\u540e\u904d\u5386\u6570\u7ec4stringstr=\"1,2,3,4,5,6,7\";string[]strArray=str.Split(',');\/\/\u5b57\u7b26\u4e32\u8f6c\u6570\u7ec4str=s...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/567"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=567"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/567\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}