<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>规则 on 墨山灼海 | 个人技术分享站</title>
    <link>https://moshanzhuohai.com/tags/%E8%A7%84%E5%88%99/</link>
    <description>Recent content in 规则 on 墨山灼海 | 个人技术分享站</description>
    <generator>Hugo</generator>
    <language>zh-Hans-CN</language>
    <managingEditor>1009840925@qq.com (墨山灼海)</managingEditor>
    <webMaster>1009840925@qq.com (墨山灼海)</webMaster>
    <lastBuildDate>Sun, 22 Nov 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://moshanzhuohai.com/tags/%E8%A7%84%E5%88%99/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>墨山的 C# 代码风格规范 - 规则</title>
      <link>https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/</link>
      <pubDate>Sun, 22 Nov 2026 00:00:00 +0000</pubDate><author>1009840925@qq.com (墨山灼海)</author>
      <guid>https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/</guid>
      <description>&lt;h2 id=&#34;目录&#34;&gt;目录&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#%e7%9b%ae%e5%bd%95&#34;&gt;目录&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#1-%e8%a7%84%e8%8c%83%e7%ba%a7%e5%88%ab&#34;&gt;1. 规范级别&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#2-%e6%9c%af%e8%af%ad&#34;&gt;2. 术语&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#21-%e4%bb%a3%e7%a0%81&#34;&gt;2.1. 代码&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#22-%e6%b3%a8%e9%87%8a&#34;&gt;2.2. 注释&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#3-%e6%95%b0%e5%ad%97%e5%90%8e%e7%bc%80&#34;&gt;3. 数字后缀&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#31-%e6%95%b4%e6%95%b0&#34;&gt;3.1. 整数&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#32-%e6%b5%ae%e7%82%b9%e6%95%b0&#34;&gt;3.2. 浮点数&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#3-%e5%86%85%e5%ae%b9&#34;&gt;3. 内容&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#31-%e9%a1%b9%e7%9b%ae&#34;&gt;3.1. 项目&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#32-%e6%96%87%e4%bb%b6&#34;&gt;3.2. 文件&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#33-%e5%91%bd%e5%90%8d&#34;&gt;3.3. 命名&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#34-%e6%a0%bc%e5%bc%8f&#34;&gt;3.4. 格式&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#35-%e6%b3%a8%e9%87%8a&#34;&gt;3.5. 注释&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#36-%e5%b8%83%e5%b1%80&#34;&gt;3.6. 布局&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#37-%e5%a3%b0%e6%98%8e&#34;&gt;3.7. 声明&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#38-%e8%af%ad%e8%a8%80%e7%89%b9%e6%80%a7&#34;&gt;3.8. 语言特性&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#%e5%8f%a6%e8%af%b7%e5%8f%82%e8%a7%81&#34;&gt;另请参见&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://moshanzhuohai.com/posts/csharp/style/csharp-code-style-rule/#%e9%99%84%e5%bd%95&#34;&gt;附录&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;1-规范级别&#34;&gt;1. 规范级别&lt;/h2&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;级别&lt;/th&gt;
					&lt;th&gt;前缀&lt;/th&gt;
					&lt;th&gt;说明&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;必须&lt;/td&gt;
					&lt;td&gt;&lt;em&gt;&lt;strong&gt;&lt;code&gt;[必须]&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/td&gt;
					&lt;td&gt;该风格规范必须遵循。&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;应该&lt;/td&gt;
					&lt;td&gt;&lt;em&gt;&lt;strong&gt;&lt;code&gt;[应该]&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/td&gt;
					&lt;td&gt;该风格规范建议遵循。&lt;br/&gt;&lt;em&gt;注：如果充分了解该风格规范的实现原因，并拥有充分的违反理由，可以不遵循。&lt;/em&gt;&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;建议&lt;/td&gt;
					&lt;td&gt;&lt;em&gt;&lt;strong&gt;&lt;code&gt;[建议]&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/td&gt;
					&lt;td&gt;该风格规范建议遵循。&lt;br/&gt;&lt;em&gt;注：可以不遵循。&lt;/em&gt;&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;禁止&lt;/td&gt;
					&lt;td&gt;&lt;em&gt;&lt;strong&gt;&lt;code&gt;[禁止]&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/td&gt;
					&lt;td&gt;该风格规范禁止使用。&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;2-术语&#34;&gt;2. 术语&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;code&gt;[必须]&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt; 项目中统一使用以下术语。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;code&gt;[禁止]&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt; 混用同义表达。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;21-代码&#34;&gt;2.1. 代码&lt;/h2&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;术语&lt;/th&gt;
					&lt;th&gt;说明&lt;/th&gt;
					&lt;th&gt;禁止&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;标志枚举&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;添加了 &lt;code&gt;[System.Flags]&lt;/code&gt; 特性标记并使用位运算的枚举类型的统称。&lt;/td&gt;
					&lt;td&gt;标记枚举、&lt;br/&gt;多选枚举&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;字段&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;在类型中声明的静态函数和实例变量的统称。&lt;br/&gt;&lt;em&gt;注：如果不添加静态前缀或实例前缀，泛指实例变量。&lt;/em&gt;&lt;/td&gt;
					&lt;td&gt;变量&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;变量&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;在类型的函数中声明的局部变量。&lt;/td&gt;
					&lt;td&gt;参数、&lt;br/&gt;字段&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;方法&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;在类型中声明的静态函数和实例函数的统称。&lt;br/&gt;&lt;em&gt;注：如果不添加静态前缀或实例前缀，泛指实例函数。&lt;/em&gt;&lt;/td&gt;
					&lt;td&gt;函数&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;局部方法&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;在类型的函数中声明的局部函数。&lt;/td&gt;
					&lt;td&gt;局部函数、&lt;br/&gt;本地函数、&lt;br/&gt;本地方法&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;属性&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;在类型中声明的、实现 &lt;code&gt;init&lt;/code&gt;、&lt;code&gt;get&lt;/code&gt; 或 &lt;code&gt;set&lt;/code&gt; 的属性的统称。&lt;/td&gt;
					&lt;td&gt;特性&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;特性&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;&lt;code&gt;System.Attribute&lt;/code&gt; 或继承了 &lt;code&gt;System.Attribute&lt;/code&gt; 的子级类型的统称。&lt;/td&gt;
					&lt;td&gt;属性&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;异常&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;&lt;code&gt;System.Exception&lt;/code&gt; 或继承了 &lt;code&gt;System.Exception&lt;/code&gt; 的子级类型的统称。&lt;/td&gt;
					&lt;td&gt;错误&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;跨度&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;&lt;code&gt;System.Span&amp;lt;T&amp;gt;&lt;/code&gt; 或 &lt;code&gt;System.ReadOnlySpan&amp;lt;T&amp;gt;&lt;/code&gt; 结构体。&lt;/td&gt;
					&lt;td&gt;范围&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;注：特殊语境下的标准领域专有名词不受限制。（例如：预处理器语境的 &amp;ldquo;函数式宏&amp;rdquo; 无需命名为 &amp;ldquo;方法式宏&amp;rdquo;。）&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description>
    </item>
  </channel>
</rss>
