<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 如何:使用 XML 文檔功能(C# 編程指南) 下面的示例提供文檔類型的基本概述。 ``` // If compiling from the command line, compile with: /doc:YourFileName.xml /// <summary> /// Class level summary documentation goes here.</summary> /// <remarks> /// Longer comments can be associated with a type or member through /// the remarks tag.</remarks> public class TestClass : TestInterface { /// <summary> /// Store for the name property.</summary> private string _name = null; /// <summary> /// The class constructor. </summary> public TestClass() { // TODO: Add Constructor Logic here. } /// <summary> /// Name property. </summary> /// <value> /// A value tag is used to describe the property value.</value> public string Name { get { if (_name == null) { throw new System.Exception("Name is null"); } return _name; } } /// <summary> /// Description for SomeMethod.</summary> /// <param name="s"> Parameter description for s goes here.</param> /// <seealso cref="System.String"> /// You can use the cref attribute on any tag to reference a type or member /// and the compiler will check that the reference exists. </seealso> public void SomeMethod(string s) { } /// <summary> /// Some other method. </summary> /// <returns> /// Return results are described through the returns tag.</returns> /// <seealso cref="SomeMethod(string)"> /// Notice the use of the cref attribute to reference a specific method. </seealso> public int SomeOtherMethod() { return 0; } public int InterfaceMethod(int n) { return n * n; } /// <summary> /// The entry point for the application. /// </summary> /// <param name="args"> A list of command line arguments.</param> static int Main(System.String[] args) { // TODO: Add code to start application here. return 0; } } /// <summary> /// Documentation that describes the interface goes here. /// </summary> /// <remarks> /// Details about the interface go here. /// </remarks> interface TestInterface { /// <summary> /// Documentation that describes the method goes here. /// </summary> /// <param name="n"> /// Parameter n requires an integer argument. /// </param> /// <returns> /// The method returns an integer. /// </returns> int InterfaceMethod(int n); } ``` ``` //此 .xml 文件生成了與上面的代碼示例。<?xml version="1.0"?> <doc> <assembly> namexmlsampleAMP_LT/nameAMP_GT </assembly> <members> member name="T:SomeClass" <summary> Class level summary documentation goes here.</summary> <remarks> Longer comments can be associated with a type or member 通過注釋 tagAMP_LT/remarksAMP_GT </member> member name="F:SomeClass.m_Name" <summary> 名稱的 propertyAMP_LT/summaryAMP_GT 存儲 </member> member name="M:SomeClass.#ctor" summary類 constructor.AMP_LT/summaryAMP_GT </member> member name="M:SomeClass.SomeMethod(System.String)" <summary> Description for SomeMethod.</summary> param name="s" 中的參數聲明轉到 hereAMP_LT/paramAMP_GT <seealso cref="T:System.String"> You can use the cref attribute on any tag to reference a type or member and the compiler will check that the reference exists.</seealso> </member> member name="M:SomeClass.SomeOtherMethod" <summary> Some other method.</summary> <returns> Return results are described through the returns tag.</returns> seealso cref="M:SomeClass.SomeMethod(System.String)" 通知使用 cref 特性引用特定方法 AMP_LT/seealsoAMP_GT </member> member name="M:SomeClass.Main(System.String[])" <summary> The entry point for the application.</summary> param name="args" 命令行 argumentsAMP_LT/paramAMP_GT 列表 </member> member name="P:SomeClass.Name" <summary> name 屬性 AMP_LT/summaryAMP_GT <value> 值標記用于描述屬性 valueAMP_LT/valueAMP_GT </member> </members> </doc> ``` ## 編譯代碼 若要編譯該示例,請鍵入以下命令行: csc XMLsample.cs /doc:XMLsample.xml 這將創建 XML 文件 XMLsample.xml,使用類型的命令,您可以在瀏覽器或。 ## 可靠編程 XML 文檔以 /// 開頭。當您創建新項目時,該向導為您放置一些起始 ///行。對這些注釋的處理有一些限制: * 文檔必須是格式良好的 XML。如果 XML 格式不正確,將生成警告,并且文檔文件將包含添加的注釋遇到錯誤。 * 開發人員可自由創建自己的標記集。具有建議的標記集 (請參見其他閱讀材料部分)。某些建議的標記具有特殊含義: * &lt;param&gt; 標記用于描述參數。如果使用,編譯器將驗證參數是否存在,以及文檔中是否描述了所有參數。如果驗證失敗,編譯器會發出警告。 * **cref** 特性可以附加到任意標記,以提供對代碼元素的引用。編譯器將驗證該代碼元素是否存在。如果驗證失敗,編譯器會發出警告。編譯器在查找 **cref** 特性中描述的類型時,會考慮所有的 **using** 語句。 * &lt;summary&gt; 標記由 Visual Studio 內的“Intellisense”使用,用來顯示類型或成員的其他相關信息。 | ![](https://box.kancloud.cn/2016-01-31_56adb62c1380a.jpg) 注意 | | :-- | | XML 文件不提供有關類型和成員的完整信息 (例如,它不包含任何類型信息)。若要獲得有關類型或成員的完整信息,文檔文件必須與實際類型或成員上的反射一起使用。 | ## 請參閱 [C# 編程指南](https://msdn.microsoft.com/zh-cn/library/67ef8sbd.aspx) [/doc (C# Compiler Options)](https://msdn.microsoft.com/zh-cn/library/3260k4x7.aspx) [XML 文檔注釋(C# 編程指南)](https://msdn.microsoft.com/zh-cn/library/b2s063f7.aspx)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看