{"id":53012,"date":"2025-08-11T22:44:46","date_gmt":"2025-08-11T14:44:46","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/53012.html"},"modified":"2025-08-11T22:44:46","modified_gmt":"2025-08-11T14:44:46","slug":"c%e7%9f%a5%e8%af%86%e5%ad%a6%e4%b9%a0-008%ef%bc%88%e7%bb%93%e6%9e%84%e7%b1%bb%e5%9e%8b%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/53012.html","title":{"rendered":"C#\u77e5\u8bc6\u5b66\u4e60-008\uff08\u200b\u200b\u7ed3\u6784\u7c7b\u578b\uff09"},"content":{"rendered":"<h2><span style=\"color:#4da8ee\">1.\u6982\u5ff5<\/span><\/h2>\n<p>\u7ed3\u6784\u7c7b\u578b&#xff08;\u6216 struct type&#xff09;\u662f\u4e00\u79cd\u53ef\u5c01\u88c5\u6570\u636e\u548c\u76f8\u5173\u529f\u80fd\u7684\u503c\u7c7b\u578b\u3002\u7b80\u5355\u6765\u8bf4&#xff1a;\u5f53\u4f60\u521b\u5efa\u4e00\u4e2a\u00a0struct\u53d8\u91cf\u65f6&#xff0c;\u8fd9\u4e2a\u53d8\u91cf\u200b\u200b\u76f4\u63a5\u5b58\u50a8\u4e86\u6574\u4e2a\u6570\u636e\u7684\u5185\u5bb9\u200b\u200b\u3002<\/p>\n<p>struct\u4e3b\u8981\u7528\u4e8e\u5c01\u88c5\u200b\u200b\u8f7b\u91cf\u7ea7\u7684\u6570\u636e\u96c6\u5408\u200b\u200b&#xff08;\u5982\u5750\u6807\u3001\u70b9\u3001\u989c\u8272\u3001\u65e5\u671f&#xff09;&#xff0c;\u5b83\u901a\u5e38\u5305\u542b\u7684\u6570\u636e\u4e0d\u591a&#xff0c;\u4e14\u6ca1\u6709\u590d\u6742\u7684\u884c\u4e3a&#xff0c;\u4e3e\u4f8b\u5982\u4e0b&#xff1a;<\/p>\n<p>public struct Coords<br \/>\n{<br \/>\n    \/\/\u8fd9\u662f\u4e00\u4e2a\u6784\u9020\u51fd\u6570&#xff0c;\u7528\u4e8e\u521b\u5efaCoords\u7ed3\u6784\u7684\u65b0\u5b9e\u4f8b<br \/>\n    \/\/\u5b83\u63a5\u53d7\u4e24\u4e2adouble\u7c7b\u578b\u7684\u53c2\u6570&#xff1a;x\u548cy,\u8d4b\u7ed9\u5bf9\u5e94\u7684\u5c5e\u6027X\u548cY<br \/>\n    public Coords(double x, double y)<br \/>\n    {<br \/>\n        X &#061; x;<br \/>\n        Y &#061; y;<br \/>\n    }<\/p>\n<p>    public double X { get; set; }  \/\/ \u81ea\u52a8\u5b9e\u73b0\u5c5e\u6027 X<br \/>\n    public double Y { get; set; }  \/\/ \u81ea\u52a8\u5b9e\u73b0\u5c5e\u6027 Y<br \/>\n}<\/p>\n<h3><span style=\"color:#1a439c\">1.1 public<\/span><\/h3>\n<p>public\u8fd9\u4e2a\u5173\u952e\u5b57&#xff0c;\u5b83\u662f C# \u4e2d\u975e\u5e38\u91cd\u8981\u7684\u4e00\u4e2a\u6982\u5ff5\u2014\u2014\u200b\u200b\u8bbf\u95ee\u4fee\u9970\u7b26\u200b\u200b<\/p>\n<p><span style=\"color:#511b78\">\u60f3\u8c61\u4e00\u4e0b\u4f60\u4f4f\u7684\u623f\u5b50&#xff1a;<\/span><\/p>\n<ul>\n<li>\n<p><span style=\"color:#511b78\">\u6709\u4e9b\u623f\u95f4&#xff08;\u6bd4\u5982\u5ba2\u5385&#xff09;\u662f \u200b\u200b\u516c\u5f00 (public)\u200b\u200b \u7684&#xff0c;\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u8fdb\u6765\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#511b78\">\u6709\u4e9b\u623f\u95f4&#xff08;\u6bd4\u5982\u4f60\u7684\u5367\u5ba4&#xff09;\u662f \u200b\u200b\u79c1\u6709 (private)\u200b\u200b \u7684&#xff0c;\u53ea\u6709\u4f60\u81ea\u5df1\u6216\u8005\u4f60\u5141\u8bb8\u7684\u4eba\u624d\u80fd\u8fdb\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#511b78\">\u8fd8\u6709\u4e00\u4e9b\u533a\u57df&#xff08;\u6bd4\u5982\u5bb6\u91cc\u7684\u4e66\u623f&#xff09;\u53ef\u80fd\u662f \u200b\u200b\u53d7\u4fdd\u62a4 (protected)\u200b\u200b \u7684&#xff0c;\u53ea\u6709\u4f60\u548c\u4f60\u7684\u5bb6\u4eba&#xff08;\u5b50\u7c7b&#xff09;\u53ef\u4ee5\u7528\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#511b78\">\u6216\u8005\u50cf\u5c0f\u533a\u91cc\u7684\u516c\u5171\u8bbe\u65bd&#xff0c;\u53ea\u6709\u672c\u5c0f\u533a\u7684\u4f4f\u6237&#xff08;\u540c\u4e00\u4e2a\u7a0b\u5e8f\u96c6&#xff09;\u53ef\u4ee5\u7528&#xff0c;\u8fd9\u53eb \u200b\u200b\u5185\u90e8 (internal)\u200b\u200b\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<p>\u5982\u679c\u4f8b\u5b50\u4e2d\u53bb\u6389public&#xff1a;<\/p>\n<p>struct Coords  \/\/ \u6ca1\u6709 public -&gt; \u9ed8\u8ba4 private!<br \/>\n{<br \/>\n    Coords(double x, double y) \/\/ \u6ca1\u6709 public -&gt; \u9ed8\u8ba4 private!<br \/>\n    {<br \/>\n        X &#061; x;<br \/>\n        Y &#061; y;<br \/>\n    }<\/p>\n<p>    double X { get; set; } \/\/ \u6ca1\u6709 public -&gt; \u9ed8\u8ba4 private!<br \/>\n    double Y { get; set; } \/\/ \u6ca1\u6709 public -&gt; \u9ed8\u8ba4 private!<br \/>\n}<\/p>\n<p>\u5982\u679c\u4f60\u60f3\u5728\u00a0Coords\u7ed3\u6784\u5916\u90e8\u521b\u5efa\u4e00\u4e2a\u5750\u6807\u70b9&#xff0c;\u4f1a\u62a5\u9519&#xff0c;\u56e0\u4e3aCoords\u7684\u6784\u9020\u51fd\u6570\u662f\u00a0private\u7684&#xff0c;\u6ca1\u6709\u6743\u9650\u8c03\u7528\u5b83&#xff01;<\/p>\n<p>Coords myPoint &#061; new Coords(1.0, 2.0); \/\/ \u8fd9\u884c\u4f1a\u62a5\u9519&#xff01;<\/p>\n<p><span style=\"color:#1c7892\">\u5982\u4f55\u9009\u62e9\u5462&#xff1f;<\/span><\/p>\n<ul>\n<li>\n<p><span style=\"color:#1c7892\">\u60f3\u8ba9\u522b\u4eba&#xff08;\u5176\u4ed6\u4ee3\u7801&#xff09;\u80fd\u7528\u4f60\u7684\u4e1c\u897f&#xff08;\u7c7b\u3001\u65b9\u6cd5\u3001\u5c5e\u6027&#xff09;&#xff1f; \u27a1\ufe0f \u52a0\u4e0a\u00a0public\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#1c7892\">\u60f3\u628a\u8fd9\u4e2a\u4e1c\u897f\u85cf\u8d77\u6765&#xff0c;\u53ea\u7ed9\u81ea\u5df1&#xff08;\u5f53\u524d\u7c7b\/\u7ed3\u6784&#xff09;\u7528&#xff1f; \u27a1\ufe0f \u7528\u00a0private&#xff08;\u6216\u8005\u4e0d\u5199\u4fee\u9970\u7b26&#xff09;\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#1c7892\">\u60f3\u53ea\u7ed9\u540c\u4e00\u4e2a\u9879\u76ee&#xff08;\u7a0b\u5e8f\u96c6&#xff09;\u91cc\u7684\u4ee3\u7801\u7528&#xff1f; \u27a1\ufe0f \u7528\u00a0internal\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#1c7892\">\u60f3\u53ea\u7ed9\u7ee7\u627f\u4f60\u7684\u5b50\u7c7b\u7528&#xff1f; \u27a1\ufe0f \u7528\u00a0protected\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<h3><span style=\"color:#1a439c\">1.2\u00a0\u81ea\u52a8\u5b9e\u73b0\u5c5e\u6027<\/span><\/h3>\n<p>\u4f8b\u5b50\u4e2d\u7684\u81ea\u52a8\u5b9e\u73b0\u5c5e\u6027&#xff08;Auto-Implemented Property&#xff09;\u58f0\u660e&#xff1a;public double X { get; set; }<\/p>\n<p>double\u200b\u200b&#xff1a;\u8868\u793a\u8fd9\u4e2a\u5c5e\u6027\u7684\u6570\u636e\u7c7b\u578b\u662f\u53cc\u7cbe\u5ea6\u6d6e\u70b9\u6570\u3002\u200b\u200bX\u200b\u200b&#xff1a;\u5c5e\u6027\u7684\u540d\u79f0\u3002<\/p>\n<p>\u200b\u200b{ get; set; }\u200b\u200b&#xff1a;\u8fd9\u662f\u5c5e\u6027\u7684\u8bbf\u95ee\u5668&#xff08;accessors&#xff09;\u58f0\u660e\u3002<\/p>\n<p><span style=\"color:#511b78\">get&#xff1a;\u8868\u793a\u83b7\u53d6\u5c5e\u6027\u503c\u7684\u8bbf\u95ee\u5668\u3002<\/span>\u5f53\u4f60\u8bfb\u53d6X\u7684\u503c\u65f6&#xff08;\u4f8b\u5982 var value &#061; obj.X;&#xff09;&#xff0c;\u5c31\u4f1a\u8c03\u7528\u8fd9\u4e2aget\u8bbf\u95ee\u5668\u3002<br \/>\n<span style=\"color:#511b78\">set&#xff1a;\u8868\u793a\u8bbe\u7f6e\u5c5e\u6027\u503c\u7684\u8bbf\u95ee\u5668\u3002<\/span>\u5f53\u4f60\u7ed9X\u8d4b\u503c\u65f6&#xff08;\u4f8b\u5982 obj.X &#061; 3.14;&#xff09;&#xff0c;\u5c31\u4f1a\u8c03\u7528\u8fd9\u4e2aset\u8bbf\u95ee\u5668\u3002<\/p>\n<p>\u81ea\u52a8\u5b9e\u73b0\u200b\u200b&#xff1a;\u8fd9\u79cd\u53ea\u6709get;\u548cset;\u800c\u6ca1\u6709\u663e\u5f0f\u5b9e\u73b0\u7684\u65b9\u5f0f&#xff0c;\u662fC#\u7684\u81ea\u52a8\u5b9e\u73b0\u5c5e\u6027\u3002<br \/>\n\u7f16\u8bd1\u5668\u4f1a\u81ea\u52a8\u751f\u6210\u4e00\u4e2a\u9690\u85cf\u7684\u3001\u6211\u4eec\u770b\u4e0d\u5230\u7684\u79c1\u6709\u5b57\u6bb5&#xff0c;\u7528\u6765\u5b58\u50a8\u5c5e\u6027\u7684\u5b9e\u9645\u503c\u3002<\/p>\n<p>\u53ea\u8bfb\u81ea\u52a8\u5c5e\u6027\u200b\u200b&#xff1a;\u5982\u679c\u53ea\u6709get\u8bbf\u95ee\u5668&#xff0c;\u6ca1\u6709set\u8bbf\u95ee\u5668&#xff0c;\u90a3\u4e48\u8fd9\u4e2a\u5c5e\u6027\u5c31\u662f\u53ea\u8bfb\u7684&#xff1a;<\/p>\n<p>public double X { get; } \/\/ \u53ea\u8bfb\u5c5e\u6027<\/p>\n<h2><span style=\"color:#4da8ee\">2.\u00a0\u7ed3\u6784\u521d\u59cb\u5316\u548c\u9ed8\u8ba4\u503c<\/span><\/h2>\n<h3><span style=\"color:#1a439c\">2.1\u00a0\u9ed8\u8ba4\u521d\u59cb\u5316&#xff08;\u96f6\u503c&#xff09;<\/span><\/h3>\n<ul>\n<li>\n<p>\u6240\u6709\u5b57\u6bb5\/\u5c5e\u6027\u88ab\u521d\u59cb\u5316\u4e3a\u96f6\u503c&#xff08;\u6570\u503c\u7c7b\u578b\u4e3a 0&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u200b\u200b\u4e0d\u8c03\u7528\u200b\u200b\u4efb\u4f55\u6784\u9020\u51fd\u6570<\/p>\n<\/li>\n<\/ul>\n<p>Coords point1 &#061; default;<br \/>\nConsole.WriteLine($&#034;{point1.X}, {point1.Y}&#034;); \/\/ 0, 0<\/p>\n<h3><span style=\"color:#1a439c\">2.2 \u6570\u7ec4\u521d\u59cb\u5316<\/span><\/h3>\n<ul>\n<li>\n<p>\u6570\u7ec4\u5143\u7d20\u81ea\u52a8\u521d\u59cb\u5316\u4e3a\u96f6\u503c<\/p>\n<\/li>\n<li>\n<p>\u4e0d\u8c03\u7528\u4efb\u4f55\u6784\u9020\u51fd\u6570<\/p>\n<\/li>\n<\/ul>\n<p>var points &#061; new Coords[3];<br \/>\nConsole.WriteLine($&#034;{points[0].X}, {points[0].Y}&#034;); \/\/ 0, 0<\/p>\n<p>\u8865\u5145&#xff1a;\u5f53\u4f60\u521b\u5efa\u6570\u7ec4&#xff1a;var points &#061; new Coords[3];<\/p>\n<p>C# \u4f1a\u200b\u200b\u81ea\u52a8\u521d\u59cb\u5316\u6bcf\u4e2a\u6570\u7ec4\u5143\u7d20\u200b\u200b\u4e3a\u7c7b\u578b\u7684\u9ed8\u8ba4\u503c&#xff08;\u96f6\u503c&#xff09;&#xff0c;\u5bf9\u4e8e\u00a0Coords\u7ed3\u6784&#xff1a;<\/p>\n<p>\/\/ \u76f8\u5f53\u4e8e\u6bcf\u4e2a\u5143\u7d20\u90fd\u6267\u884c\u4e86&#xff1a;<br \/>\npoints[0] &#061; default(Coords); \/\/ X&#061;0, Y&#061;0<br \/>\npoints[1] &#061; default(Coords); \/\/ X&#061;0, Y&#061;0<br \/>\npoints[2] &#061; default(Coords); \/\/ X&#061;0, Y&#061;0<\/p>\n<h3><span style=\"color:#1a439c\">2.3\u00a0<\/span><span style=\"color:#1a439c\">\u4f7f\u7528new\u4f46\u4e0d\u4f20\u53c2\u6570&#xff08;\u9519\u8bef&#xff09;<\/span><\/h3>\n<ul>\n<li>\n<p>\u56e0\u4e3a\u6ca1\u6709\u65e0\u53c2\u6570\u6784\u9020\u51fd\u6570<\/p>\n<\/li>\n<li>\n<p>\u5982\u679c\u6dfb\u52a0\u65e0\u53c2\u6570\u6784\u9020\u51fd\u6570&#xff08;C#10&#043;&#xff09;&#xff0c;\u884c\u4e3a\u4f1a\u6539\u53d8<\/p>\n<\/li>\n<\/ul>\n<p>\/\/ \u7f16\u8bd1\u9519\u8bef&#xff1a;\u6ca1\u6709\u65e0\u53c2\u6570\u6784\u9020\u51fd\u6570<br \/>\nCoords point2 &#061; new Coords();<\/p>\n<h3><span style=\"color:#1a439c\">2.4 \u4f7f\u7528\u81ea\u5b9a\u4e49\u6784\u9020\u51fd\u6570<\/span><\/h3>\n<ul>\n<li>\n<p>\u6b63\u5e38\u8c03\u7528\u81ea\u5b9a\u4e49\u6784\u9020\u51fd\u6570<\/p>\n<\/li>\n<\/ul>\n<p>Coords point3 &#061; new Coords(5, 10);<br \/>\nConsole.WriteLine($&#034;{point3.X}, {point3.Y}&#034;); \/\/ 5, 10<\/p>\n<h3><span style=\"color:#1a439c\">2.5 \u624b\u52a8\u521d\u59cb\u5316&#xff08;\u4e0d\u4f7f\u7528new&#xff09;<\/span><\/h3>\n<ul>\n<li>\n<p>\u5fc5\u987b\u5728\u4f7f\u7528\u524d\u521d\u59cb\u5316\u6240\u6709\u5b57\u6bb5<\/p>\n<\/li>\n<li>\n<p>\u4e0d\u8c03\u7528\u4efb\u4f55\u6784\u9020\u51fd\u6570<\/p>\n<\/li>\n<\/ul>\n<p>Coords point4;<br \/>\npoint4.X &#061; 15;<br \/>\npoint4.Y &#061; 20;<br \/>\nConsole.WriteLine($&#034;{point4.X}, {point4.Y}&#034;); \/\/ 15, 20<\/p>\n<p>\u8865\u5145&#xff1a;\u90e8\u5206\u521d\u59cb\u5316\u95ee\u9898&#xff08;\u7f16\u8bd1\u9519\u8bef&#xff09;<\/p>\n<p>Coords point5;<br \/>\npoint5.X &#061; 3; \/\/ \u53ea\u521d\u59cb\u5316\u4e00\u4e2a<br \/>\nConsole.WriteLine(point5.Y); \/\/ \u9519\u8bef: \u4f7f\u7528\u4e86\u672a\u8d4b\u503c\u7684\u53d8\u91cf<\/p>\n<p><span style=\"color:#1c7892\">\u603b\u7ed3&#xff1a;<\/span><\/p>\n<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:650px\">\n<tbody>\n<tr>\n<p>\u200b\u200b\u521d\u59cb\u5316\u65b9\u5f0f\u200b\u200b<\/p>\n<p>\u200b\u200b\u662f\u5426\u8c03\u7528\u6784\u9020\u51fd\u6570\u200b\u200b<\/p>\n<p>\u200b\u200b\u5b57\u6bb5\u503c\u200b\u200b<\/p>\n<p>\u200b\u200b\u662f\u5426\u5b89\u5168\u200b\u200b<\/p>\n<\/tr>\n<tr>\n<td>\n<p>default(Coords)<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>X&#061;0, Y&#061;0<\/p>\n<\/td>\n<td>\n<p>\u5b89\u5168<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u6570\u7ec4\u5143\u7d20<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>X&#061;0, Y&#061;0<\/p>\n<\/td>\n<td>\n<p>\u5b89\u5168<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>new Coords(1,2)<\/p>\n<\/td>\n<td>\n<p>\u662f<\/p>\n<\/td>\n<td>\n<p>\u6839\u636e\u6784\u9020\u51fd\u6570\u8d4b\u503c<\/p>\n<\/td>\n<td>\n<p>\u5b89\u5168<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u624b\u52a8\u521d\u59cb\u5316<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u624b\u52a8\u8d4b\u503c<\/p>\n<\/td>\n<td>\n<p>\u200b\u200b\u9700\u5b8c\u5168\u521d\u59cb\u5316\u200b\u200b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>new Coords()<\/p>\n<\/td>\n<td>\n<p>\u9519\u8bef&#xff08;\u65e0\u6b64\u6784\u9020\u51fd\u6570&#xff09;<\/p>\n<\/td>\n<td>\n<p>&#8211;<\/p>\n<\/td>\n<td>\n<p>\u7f16\u8bd1\u9519\u8bef<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span style=\"color:#4da8ee\">3.\u201c\u503c\u8bed\u4e49\u201d<\/span><\/h2>\n<h3><span style=\"color:#1a439c\">3.1 \u200b\u200b\u8d4b\u503c\u5c31\u662f\u590d\u5236<\/span><\/h3>\n<p>\u5f53\u4f60\u5c06\u4e00\u4e2a\u00a0struct\u53d8\u91cf (A) \u8d4b\u503c\u7ed9\u53e6\u4e00\u4e2a\u00a0struct\u53d8\u91cf (B) \u65f6&#xff0c;\u4f1a\u53d1\u751f\u4ec0\u4e48&#xff1f;<\/p>\n<p>A\u53d8\u91cf\u91cc\u5b58\u50a8\u7684\u200b\u200b\u6574\u4e2a\u6570\u636e\u5185\u5bb9\u4f1a\u88ab\u5b8c\u6574\u5730\u3001\u9010\u5b57\u8282\u5730\u590d\u5236\u4e00\u4efd\u200b\u200b\u653e\u5230 B\u53d8\u91cf\u91cc\u3002\u4fee\u6539 B\u200b\u4e0d\u4f1a\u200b\u200b\u5f71\u54cd\u539f\u6765\u7684\u00a0A\u3002\u6211\u4eec\u7ee7\u7eed\u4f7f\u7528\u4e0a\u8ff0\u7684Coords\u7ed3\u6784\u4e3e\u4f8b&#xff1a;<\/p>\n<p>Coords point1 &#061; new Coords(10, 20);<br \/>\nCoords point2 &#061; point1; \/\/ \u5c06 point1 \u7684\u6570\u636e (10,20) \u6574\u4e2a\u590d\u5236\u4e00\u4efd\u7ed9 point2<\/p>\n<p>point2.X &#061; 30; \/\/ \u4fee\u6539 point2 \u7684 X<br \/>\nConsole.WriteLine(point1.X &#043; &#034;,&#034; &#043; point1.Y);  \/\/ \u8f93\u51fa: (10, 20)  -&gt; point1 \u6ca1\u53d8&#xff01;<br \/>\nConsole.WriteLine(point2.X &#043; &#034;,&#034; &#043; point2.Y);  \/\/ \u8f93\u51fa: (30, 20) -&gt; \u53ea\u6709 point2 \u53d8\u4e86<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"456\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811144445-689a01ddb3cb2.png\" width=\"968\" \/><\/p>\n<h3><span style=\"color:#1a439c\">3.2 \u4f20\u53c2\u65f6\u4e5f\u662f\u590d\u5236\u200b\u200b<\/span><\/h3>\n<p>\u5f53\u4f60\u5c06\u4e00\u4e2a struct\u53d8\u91cf\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\u7ed9\u4e00\u4e2a\u65b9\u6cd5\u65f6&#xff0c;\u4f20\u9012\u7684\u4e5f\u662f\u5b83\u7684\u200b\u200b\u6570\u636e\u526f\u672c\u200b\u200b\u3002\u65b9\u6cd5\u5185\u90e8\u5bf9\u8fd9\u4e2a\u53c2\u6570\u7684\u4fee\u6539&#xff0c;\u901a\u5e38\u200b\u200b\u4e0d\u4f1a\u200b\u200b\u5f71\u54cd\u65b9\u6cd5\u5916\u9762\u539f\u6765\u7684\u90a3\u4e2a\u53d8\u91cf&#xff08;\u9664\u975e\u7528\u4e86 ref\u6216 out&#xff09;\u3002<\/p>\n<p>void ModifyCoord(Coords coord)<br \/>\n{<br \/>\n    coord.X &#061; 100; \/\/ \u4fee\u6539\u7684\u662f\u4f20\u5165\u7684\u90a3\u4e2a\u526f\u672c<br \/>\n}<\/p>\n<p>Coords myPoint &#061; new Coords(5, 5);<br \/>\nModifyCoord(myPoint);<br \/>\nConsole.WriteLine(myPoint); \/\/ \u8f93\u51fa: (5, 5) -&gt; myPoint \u6ca1\u53d8&#xff01;<\/p>\n<h3><span style=\"color:#1a439c\">3.3\u00a0\u200b\u200b\u8fd4\u56de\u65f6\u4e5f\u662f\u590d\u5236\u200b\u200b<\/span><\/h3>\n<p>\u5f53\u4e00\u4e2a\u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2a struct\u65f6&#xff0c;\u8fd4\u56de\u7684\u4e5f\u662f\u5b83\u7684\u4e00\u4e2a\u200b\u200b\u526f\u672c\u200b\u200b\u3002&#xff08;\u4e86\u89e3\u5373\u53ef&#xff09;<\/p>\n<h2><span style=\"color:#4da8ee\">4. readonly<\/span><\/h2>\n<p>\u53ef\u4ee5\u4f7f\u7528\u00a0readonly\u00a0\u4fee\u9970\u7b26\u6765\u58f0\u660e\u7ed3\u6784\u7c7b\u578b\u4e3a\u4e0d\u53ef\u53d8\u3002\u00a0readonly\u00a0\u7ed3\u6784\u7684\u6240\u6709\u6570\u636e\u6210\u5458\u90fd\u5fc5\u987b\u662f\u53ea\u8bfb\u7684&#xff0c;\u5982\u4e0b\u6240\u793a&#xff1a;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4efb\u4f55\u5b57\u6bb5\u58f0\u660e\u90fd\u5fc5\u987b\u5177\u6709\u00a0readonly\u00a0\u4fee\u9970\u7b26\u3002<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4efb\u4f55\u5c5e\u6027&#xff08;\u5305\u62ec\u81ea\u52a8\u5b9e\u73b0\u7684\u5c5e\u6027&#xff09;\u90fd\u5fc5\u987b\u662f\u53ea\u8bfb\u7684&#xff0c;\u6216\u8005\u662f\u00a0init\u00a0\u53ea\u8bfb\u7684\u3002<\/p>\n<p>\u7528\u00a0readonly\u4fee\u9970\u7684\u7ed3\u6784\u4f53&#xff0c;\u200b\u200b\u4ece\u8bbe\u8ba1\u4e0a\u4fdd\u8bc1\u5b83\u521b\u5efa\u540e\u5185\u5bb9\u7edd\u5bf9\u4e0d\u53ef\u53d8\u200b\u200b\u3002\u7c7b\u4f3c\u4f60\u7ed9\u7ed3\u6784\u4f53\u5957\u4e86\u4e2a&#034;\u91d1\u949f\u7f69&#034;\u3002<\/p>\n<p>public readonly struct Coords \/\/ \u2190 \u5173\u952e\u58f0\u660e<br \/>\n{<br \/>\n    public Coords(double x, double y)<br \/>\n    {<br \/>\n        X &#061; x;<br \/>\n        Y &#061; y;<br \/>\n    }<\/p>\n<p>    \/\/public double X { get; set; } \/\/ \u7f16\u8bd1\u9519\u8bef&#xff01;\u4e0d\u80fd\u6709\u53ef\u5199\u5c5e\u6027&#xff08;set&#xff09;<\/p>\n<p>    public double X { get; } \/\/ \u53ea\u8bfb\u5c5e\u6027&#xff08;\u65e0set&#xff09;<br \/>\n    public double Y { get; init; } \/\/ init-only\u5c5e\u6027&#xff08;\u4ec5\u6784\u9020\u65f6\u53ef\u8d4b\u503c&#xff09;<\/p>\n<p>    public override string ToString() &#061;&gt; $&#034;({X}, {Y})&#034;;<br \/>\n}<\/p>\n<h2><span style=\"color:#4da8ee\">5.\u975e\u7834\u574f\u6027\u53d8\u5316&#xff08;with\u8868\u8fbe\u5f0f&#xff09;<\/span><\/h2>\n<ul>\n<li>\u200b\u200b\u975e\u7834\u574f\u6027\u200b\u200b&#xff1a;\u539f\u59cb\u5bf9\u8c61\u4e0d\u4f1a\u88ab\u4fee\u6539\u200b\u200b<\/li>\n<li>\u200b\u200b\u8bed\u6cd5\u200b\u200b&#xff1a;\u6e90\u5bf9\u8c61 with { \u8981\u4fee\u6539\u7684\u5c5e\u6027 &#061; \u65b0\u503c }<\/li>\n<li>\u200b\u200b\u8981\u6c42\u200b\u200b&#xff1a;\n<ul>\n<li>\u7ed3\u6784\u4f53\u5fc5\u987b\u662f readonly<\/li>\n<li>\u5c5e\u6027\u5fc5\u987b\u6709 init\u8bbf\u95ee\u5668<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\/\/ \u4f7f\u7528<br \/>\nvar p1 &#061; new Coords(0, 0);<br \/>\nvar p2 &#061; p1 with { X &#061; 30 }; \/\/ \u521b\u5efa p1 \u7684\u526f\u672c&#xff0c;\u53ea\u4fee\u6539 X<\/p>\n<p>public readonly struct Coords \/\/ \u5fc5\u987b\u662f\u53ea\u8bfb\u7ed3\u6784<br \/>\n{<br \/>\n    public double X { get; init; } \/\/ init \u5141\u8bb8\u521d\u59cb\u5316\u540e\u5b89\u5168\u4fee\u6539\u526f\u672c<br \/>\n    public double Y { get; init; }<br \/>\n}<\/p>\n<h2><span style=\"color:#4da8ee\">6.\u8bb0\u5f55\u7ed3\u6784&#xff08;record struct&#xff09;<\/span><\/h2>\n<p>\u8fd9\u662f\u00a0with\u8868\u8fbe\u5f0f\u7684\u589e\u5f3a\u7248&#xff1a;<\/p>\n<ul>\n<li>\u200b\u200b\u8d85\u7ea7\u7b80\u6d01\u200b\u200b&#xff1a;\u4e00\u884c\u4ee3\u7801\u5b9a\u4e49\u6574\u4e2a\u7ed3\u6784\u4f53<\/li>\n<li>\u200b\u200b\u81ea\u52a8\u529f\u80fd\u200b\u200b&#xff1a;\n<ul>\n<li>\u81ea\u52a8\u751f\u6210 ToString()\u65b9\u6cd5<\/li>\n<li>\u81ea\u52a8\u751f\u6210\u503c\u6bd4\u8f83&#xff08;Equals&#xff09;<\/li>\n<li>\u81ea\u52a8\u652f\u6301 with\u8868\u8fbe\u5f0f<\/li>\n<\/ul>\n<\/li>\n<li>\u200b\u200b\u4e24\u79cd\u7c7b\u578b\u200b\u200b&#xff1a;\n<ul>\n<li>record struct&#xff1a;\u53ef\u53d8\u8bb0\u5f55<\/li>\n<li>readonly record struct&#xff1a;\u4e0d\u53ef\u53d8\u8bb0\u5f55<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\/\/\u81ea\u52a8\u751f\u6210 ToString()\u65b9\u6cd5<br \/>\nvar point &#061; new Coords(3, 4);<br \/>\nConsole.WriteLine(point); \/\/ \u8f93\u51fa&#xff1a;Coords { X &#061; 3, Y &#061; 4 }<\/p>\n<p>\/\/\u81ea\u52a8\u751f\u6210\u200b\u200b\u503c\u6bd4\u8f83\u200b\u200b\u903b\u8f91<br \/>\nvar p1 &#061; new Coords(1, 2);<br \/>\nvar p2 &#061; new Coords(1, 2);<br \/>\nvar p3 &#061; new Coords(3, 4);<\/p>\n<p>Console.WriteLine(p1 &#061;&#061; p2);  \/\/ \u8f93\u51fa&#xff1a;True&#xff08;\u503c\u76f8\u540c&#xff09;<br \/>\nConsole.WriteLine(p1.Equals(p3));  \/\/ \u8f93\u51fa&#xff1a;False&#xff08;\u503c\u4e0d\u540c&#xff09;<\/p>\n<p>\/\/ \u81ea\u52a8\u652f\u6301 with\u8868\u8fbe\u5f0f<br \/>\nvar p1 &#061; new Coords(10, 20);<br \/>\nvar p2 &#061; p1 with { X &#061; 30 };<\/p>\n<p>public record struct Coords(double X, double Y); \/\/ \u4e00\u884c\u5b9a\u4e49&#xff01;<\/p>\n<p>\u5b66\u5230\u4e86\u8fd9\u91cc&#xff0c;\u54b1\u4fe9\u771f\u68d2&#xff0c;\u8bb0\u5f97\u6309\u65f6\u5403\u996d&#xff08;\u5e0c\u671b\u4f60\u4eca\u5929\u662f\u5f00\u5fc3\u7684~&#xff09;<\/p>\n<p>\u3010\u672c\u7bc7\u7ed3\u675f&#xff0c;\u65b0\u7684\u77e5\u8bc6\u4f1a\u4e0d\u5b9a\u65f6\u8865\u5145\u3011<\/p>\n<p>\u611f\u8c22\u4f60\u7684\u9605\u8bfb&#xff01;\u5982\u679c\u5185\u5bb9\u6709\u5e2e\u52a9&#xff0c;\u6b22\u8fce \u200b\u200b\u70b9\u8d5e\u2764\ufe0f &#043; \u6536\u85cf\u2b50 &#043; \u5173\u6ce8\u200b\u200b \u652f\u6301&#xff01; &#x1f60a;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb498\u6b21\uff0c\u70b9\u8d5e14\u6b21\uff0c\u6536\u85cf7\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86C#\u4e2d\u7ed3\u6784\u7c7b\u578b(struct)\u7684\u6838\u5fc3\u6982\u5ff5\u548c\u4f7f\u7528\u65b9\u5f0f\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1) \u7ed3\u6784\u4f53\u662f\u503c\u7c7b\u578b\uff1b2) \u8bbf\u95ee\u4fee\u9970\u7b26\uff1b3) \u81ea\u52a8\u5b9e\u73b0\u5c5e\u6027\uff1b4) \u591a\u79cd\u521d\u59cb\u5316\u65b9\u5f0f\uff1b5) \u503c\u8bed\u4e49\u7279\u6027\uff1b6) readonly\u7ed3\u6784\u4f53\u7684\u4e0d\u53ef\u53d8\u7279\u6027\uff1b7) with\u8868\u8fbe\u5f0f\u5b9e\u73b0\u975e\u7834\u574f\u6027\u4fee\u6539\uff1b8) record struct\u7684\u7b80\u5316\u8bed\u6cd5\u548c\u81ea\u52a8\u529f\u80fd\u3002\u6587\u7ae0\u901a\u8fc7\u5750\u6807\u7ed3\u6784\u793a\u4f8b\u8be6\u7ec6\u8bb2\u89e3\u4e86\u5404\u7279\u6027\u7684\u4f7f\u7528\u573a\u666f\u548c\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n","protected":false},"author":2,"featured_media":53011,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,371],"topic":[],"class_list":["post-53012","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-c","tag-371"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C#\u77e5\u8bc6\u5b66\u4e60-008\uff08\u200b\u200b\u7ed3\u6784\u7c7b\u578b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/53012.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C#\u77e5\u8bc6\u5b66\u4e60-008\uff08\u200b\u200b\u7ed3\u6784\u7c7b\u578b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb498\u6b21\uff0c\u70b9\u8d5e14\u6b21\uff0c\u6536\u85cf7\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86C#\u4e2d\u7ed3\u6784\u7c7b\u578b(struct)\u7684\u6838\u5fc3\u6982\u5ff5\u548c\u4f7f\u7528\u65b9\u5f0f\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1) \u7ed3\u6784\u4f53\u662f\u503c\u7c7b\u578b\uff1b2) \u8bbf\u95ee\u4fee\u9970\u7b26\uff1b3) \u81ea\u52a8\u5b9e\u73b0\u5c5e\u6027\uff1b4) \u591a\u79cd\u521d\u59cb\u5316\u65b9\u5f0f\uff1b5) \u503c\u8bed\u4e49\u7279\u6027\uff1b6) readonly\u7ed3\u6784\u4f53\u7684\u4e0d\u53ef\u53d8\u7279\u6027\uff1b7) with\u8868\u8fbe\u5f0f\u5b9e\u73b0\u975e\u7834\u574f\u6027\u4fee\u6539\uff1b8) record struct\u7684\u7b80\u5316\u8bed\u6cd5\u548c\u81ea\u52a8\u529f\u80fd\u3002\u6587\u7ae0\u901a\u8fc7\u5750\u6807\u7ed3\u6784\u793a\u4f8b\u8be6\u7ec6\u8bb2\u89e3\u4e86\u5404\u7279\u6027\u7684\u4f7f\u7528\u573a\u666f\u548c\u6ce8\u610f\u4e8b\u9879\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/53012.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-11T14:44:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811144445-689a01ddb3cb2.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/53012.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/53012.html\",\"name\":\"C#\u77e5\u8bc6\u5b66\u4e60-008\uff08\u200b\u200b\u7ed3\u6784\u7c7b\u578b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-11T14:44:46+00:00\",\"dateModified\":\"2025-08-11T14:44:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/53012.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/53012.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/53012.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C#\u77e5\u8bc6\u5b66\u4e60-008\uff08\u200b\u200b\u7ed3\u6784\u7c7b\u578b\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C#\u77e5\u8bc6\u5b66\u4e60-008\uff08\u200b\u200b\u7ed3\u6784\u7c7b\u578b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/53012.html","og_locale":"zh_CN","og_type":"article","og_title":"C#\u77e5\u8bc6\u5b66\u4e60-008\uff08\u200b\u200b\u7ed3\u6784\u7c7b\u578b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb498\u6b21\uff0c\u70b9\u8d5e14\u6b21\uff0c\u6536\u85cf7\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86C#\u4e2d\u7ed3\u6784\u7c7b\u578b(struct)\u7684\u6838\u5fc3\u6982\u5ff5\u548c\u4f7f\u7528\u65b9\u5f0f\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1) \u7ed3\u6784\u4f53\u662f\u503c\u7c7b\u578b\uff1b2) \u8bbf\u95ee\u4fee\u9970\u7b26\uff1b3) \u81ea\u52a8\u5b9e\u73b0\u5c5e\u6027\uff1b4) \u591a\u79cd\u521d\u59cb\u5316\u65b9\u5f0f\uff1b5) \u503c\u8bed\u4e49\u7279\u6027\uff1b6) readonly\u7ed3\u6784\u4f53\u7684\u4e0d\u53ef\u53d8\u7279\u6027\uff1b7) with\u8868\u8fbe\u5f0f\u5b9e\u73b0\u975e\u7834\u574f\u6027\u4fee\u6539\uff1b8) record struct\u7684\u7b80\u5316\u8bed\u6cd5\u548c\u81ea\u52a8\u529f\u80fd\u3002\u6587\u7ae0\u901a\u8fc7\u5750\u6807\u7ed3\u6784\u793a\u4f8b\u8be6\u7ec6\u8bb2\u89e3\u4e86\u5404\u7279\u6027\u7684\u4f7f\u7528\u573a\u666f\u548c\u6ce8\u610f\u4e8b\u9879\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/53012.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-11T14:44:46+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811144445-689a01ddb3cb2.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/53012.html","url":"https:\/\/www.wsisp.com\/helps\/53012.html","name":"C#\u77e5\u8bc6\u5b66\u4e60-008\uff08\u200b\u200b\u7ed3\u6784\u7c7b\u578b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-11T14:44:46+00:00","dateModified":"2025-08-11T14:44:46+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/53012.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/53012.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/53012.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C#\u77e5\u8bc6\u5b66\u4e60-008\uff08\u200b\u200b\u7ed3\u6784\u7c7b\u578b\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/53012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=53012"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/53012\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/53011"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=53012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=53012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=53012"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=53012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}