C# demonstrates how to document code using XML

From , 5 Years ago, written in C#, viewed 87 times.
URL https://pastebin.vip/view/1713a23c
  1. // XMLsample.cs
  2. // 编译时使用:/doc:XMLsample.xml
  3. using System;
  4.  
  5. /// <summary>
  6. /// 此处显示类级别摘要文档。 </summary>
  7. /// <remarks>
  8. /// 较长的注释可通过 remarks 标记与类型或成员
  9. /// 关联 </remarks>
  10. public class SomeClass
  11. {
  12.    /// <summary>
  13.    /// Name 属性的存储区</summary>
  14.    private string myName = null;
  15.  
  16.    /// <summary>
  17.    /// 类构造函数。 </summary>
  18.    public SomeClass()
  19.    {
  20.        // TODO:在此处添加构造函数逻辑
  21.    }
  22.    
  23.    /// <summary>
  24.    /// Name 属性 </summary>
  25.    /// <value>
  26.    /// value 标记用于描述属性值</value>
  27.    public string Name
  28.    {
  29.       get
  30.       {
  31.          if ( myName == null )
  32.          {
  33.             throw new Exception("Name is null");
  34.          }
  35.              
  36.          return myName;
  37.       }
  38.    }
  39.  
  40.    /// <summary>
  41.    /// SomeMethod 的说明。</summary>
  42.    /// <param name="s"> 此处显示 s 的参数说明</param>
  43.    /// <seealso cref="String">
  44.    /// 可以在任何标记上使用 cref 属性来引用类型或成员
  45.    /// 编译器将检查该引用是否存在。 </seealso>
  46.    public void SomeMethod(string s)
  47.    {
  48.    }
  49.  
  50.    /// <summary>
  51.    /// 一些其他方法。 </summary>
  52.    /// <returns>
  53.    /// 返回结果通过 returns 标记描述。</returns>
  54.    /// <seealso cref="SomeMethod(string)">
  55.    /// 注意引用特定方法的 cref 属性的使用 </seealso>
  56.    public int SomeOtherMethod()
  57.    {
  58.       return 0;
  59.    }
  60.  
  61.    /// <summary>
  62.    /// 应用程序的入口点。
  63.    /// </summary>
  64.    /// <param name="args"> 命令行参数列表</param>
  65.    public static int Main(String[] args)
  66.    {
  67.       // TODO:在此处添加启动应用程序的代码
  68.  
  69.        return 0;
  70.    }
  71. }
  72.  
  73. //csharp/4931

Reply to "C# demonstrates how to document code using XML"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website