.net方法參數注釋編寫執行個體

來源:互聯網
上載者:User
       原帖地址:http://blog.csdn.net/kgdiwss/archive/2006/11/30/1422388.aspx

         主要是example,code標記等的運用,怕忘了,所以記錄一下.

         #region GetLatestJobInfo         ///<summary>         ///擷取最新的職位資訊         ///</summary>         ///<example>               ///<code>         ///<font face="宋體" size="2">         /// [C#]         /// public class MyClass         /// {         ///      public void myMethod()         ///      {         ///           <font color="green">//建立web service對象</font>         ///           wsJobPosition position = new wsJobPosition();         ///                    ///           <font color="green">//擷取最新條資訊</font>         ///           <font color="green">//前一個參數表示擷取的記錄條數,後一個參數表示排序欄位,""表示按dtCreate降序</font>         ///           DataSet ds = position.GetLatestJobInfo(10, "");             ///                    ///           <font color="green">//其它代碼</font>         ///      }         /// }         ///          ///</font>          ///</code>         ///</example>         ///<param name="topNumber">顯示最新條數</param>         ///<param name="orderField">降序排列的欄位,預設為dtCreate</param>         ///<returns>返回某欄位降序排列的前N條記錄</returns>         [WebMethod]            public DataSet GetLatestJobInfo(int topNumber, string orderField)         {              DataSet ds = new DataSet();              DataTable dt;                orderField = orderField == "" ? "dtCreate" : orderField;               string sql = "SELECT TOP {0} * FROM Job_Position order by {1} desc";              sql = string.Format(sql, topNumber, orderField);               dt = clsFactory.Create().GetDataTable(sql);              ds.Tables.Add(dt);                         return ds;         }         #endregion

       用NDoc產生的說明如下: 

       擷取最新的職位資訊

       public DataSet GetLatestJobInfo(
       int topNumber,
       string orderField
       );

       參數
       topNumber
           顯示最新條數
       orderField
           降序排列的欄位,預設為dtCreate

       傳回值
           返回某欄位降序排列的前N條記錄

       樣本

       [C#]
       public class MyClass
       {
             public void myMethod()
             {
              //建立web service對象
              wsJobPosition position = new wsJobPosition();

              //擷取最新10條資訊
              //前一個參數表示擷取的記錄條數,後一個參數表示排序欄位,""表示按dtCreate降序
              DataSet ds = position.GetLatestJobInfo(10, "");    
             
              //其它代碼
             }
       }

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.