编写类库时如何添加注释,使得在使用类库的时候有相应的代码提示

首先编写类库源代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CustomLib
{

    /// <summary>
    /// 自定义业务异常,本系统所有其它自定义异常,需从本类派生
    /// </summary>      
    public class MyCustomLib
    {    
        /// <summary>
        /// 该方法用于打印姓名      
        /// </summary>
      
        public static  void Display(string strName)
        {

            Console.WriteLine(strName);
        }
    
    }
}

 

注释如上添加,然后右键工程属性,在生成一项设置:

输出路径:C:\Users\ganquanfu\Desktop\bin\

Xml文档文件:C:\Users\ganquanfu\Desktop\bin\CustomLib.xml(注意这个xml文件名应与类库文件名相同);

 

使用类库CustomLib.dll;

添加引用CustomLib.dll

然后

   CustomLib.MyCustomLib.Display("甘全福");        
            decimal d = 100m;
            Console.WriteLine(d);

在Display函数上按F12自定义转到CustomLib.dll文件如下:

#region 程序集 CustomLib.dll, v4.0.30319
#endregion

using System;

namespace CustomLib
{
    // 摘要:
    //     自定义业务异常,本系统所有其它自定义异常,需从本类派生
    public class MyCustomLib
    {
        public MyCustomLib();

        // 摘要:
        //     该方法用于打印姓名
        public static void Display(string strName);
    }
}

posted @ 2013-03-25 16:15  Predator  阅读(207)  评论(0编辑  收藏  举报