类之前的
///Summary就是说明。

解决方案 »

  1.   

    try to add a DescriptionAttribute  before your class/method[Description("SomeDescription Here.")]
    class YourClass
      

  2.   

    [Category("Appearance")]-->此处指放到外观那一类,不然你的属性会放在杂项里
    [Description("la..la..la..lala")] 定制你的属性的描述
    public string Name{get;}
      

  3.   


    [Description("设置在注册表启动项中键名的属性")]
    public string RegName
    {
    get
    {return regName;}
    set
    {regName=value;}
                       }
    F:\projects\StartWithReg\StartWithComputer.cs(72): 找不到类型或命名空间名称“Description”(是否缺少 using 指令或程序集引用?)
    怎么会这样呢.大家给我说清楚点,好吗?
    最好能帧出代码来.谢谢了
      

  4.   

    using System.ComponentModel;Description is same as DescriptionAttribute
      

  5.   

    是像下面这样吗?
             [Description("关闭注册表"),Category("Appearance")]
    public void CloseReg()
    {
    StartPath.Close();
    STARTWITH.Close();
    }可是不行啊
    我在另一个工程中引用这个库文件,可是在实例化对象后,调用这个方法时,并不出现"关闭注册表的提示"啊,大哥们能提供个例子吗?
      

  6.   

    在任何一个元素前面写说明的时候,输入"///",系统就会自动把一个XML标准的说明框架列出来,然后在其中的<summary>段中写说明,这样在引用这个类或者函数的时候,鼠标旁边的提示中就会有他的说明了。
      

  7.   

    [Description("设置在注册表启动项中键名的属性")]
    public string RegName
    {
    get
    {return regName;}
    set
    {regName=value;}
                       }
    上面这一种,偶试过好几次都不行.
    "在任何一个元素前面写说明的时候,输入"///",系统就会自动把一个XML标准的说明框架列出来,然后在其中的<summary>段中写说明,这样在引用这个类或者函数的时候,鼠标旁边的提示中就会有他的说明了。"这个如果在同个工程中调用另一类的对象是可以的,确实可以能达到所要的效果.可是我把一个类输出为dll文件,然后在另一工程中引用它时,就不行了,
    还有高手能指点一下吗?
      

  8.   

    试过了,以上方法在编译成dll以后都不能显示说明关注ing...
      

  9.   

    MSDN例子如下: 以下示例创建 MyImage 属性。该属性有两个特性:DescriptionAttribute 和 CategoryAttribute。[Visual Basic] 
    <Description("The image associated with the control"), _
        Category("Appearance")> _
    Public Property MyImage() As Image
        Get
            ' Insert code here.
            Return image1
        End Get
        Set
            ' Insert code here.
        End Set 
    End Property
    [C#] 
    [Description("The image associated with the control"),Category("Appearance")] 
     public Image MyImage {
        get {
           // Insert code here.
           return image1;
        }
        set {
           // Insert code here.
        }
     }
    [Visual Basic, C#] 下一个示例获取 MyImage 的说明。首先,代码获取具有该对象的所有属性的 PropertyDescriptorCollection。接着,它对 PropertyDescriptorCollection 进行索引以获取 MyImage。然后它返回该属性的特性,并将它们保存到特性变量中。[Visual Basic, C#] 然后该示例通过以下方法输出说明:从 AttributeCollection 检索 DescriptionAttribute,然后将它写到控制台屏幕上。[Visual Basic] 
    ' Gets the attributes for the property.
    Dim attributes As AttributeCollection = _
        TypeDescriptor.GetProperties(Me)("MyImage").Attributes' Prints the description by retrieving the DescriptionAttribute
    ' from the AttributeCollection. 
    Dim myAttribute As DescriptionAttribute = _
        CType(attributes(GetType(DescriptionAttribute)), DescriptionAttribute)
    Console.WriteLine(myAttribute.Description)
    [C#] 
    // Gets the attributes for the property.
     AttributeCollection attributes = 
        TypeDescriptor.GetProperties(this)["MyImage"].Attributes;
     
     /* Prints the description by retrieving the DescriptionAttribute 
      * from the AttributeCollection. */
     DescriptionAttribute myAttribute = 
        (DescriptionAttribute)attributes[typeof(DescriptionAttribute)];
     Console.WriteLine(myAttribute.Description);
      

  10.   

    我找到了!把这段代码放到一个函数的前面/// <summary>
    /// 函数介绍
    /// </summary>
    /// <PARAM name="参数名"></PARAM>
    /// 参数说明
      

  11.   

    在XML WebService 中的说明:
    ==========================
    [WebMethod(Description = "这是我的Web方法的说明内容……")]
    public Int32 GetUserID(Object UserName)
    {
    return 0;
    }在一般的C#类中的关于函数或属性的说明:
    =====================================
    /// <summary>方法简介:返回指定用户或角色的编号。</summary>
    /// <param name="UserName">参数说明:用户或角色的名称或编号。</param>
    /// <res>备注描述:如果参数UserName为空引用(在Visual Basic中为Nothing)则默认为当前登录用户。</res>
    public Int32 GetUserID(Object UserName)
    {
    return 1;
    }
    /* 在C#中,只要在函数外面输入三个“/”,系统就会自动产生XML注释标签的,很好用的!!! 更多详细信息请参考.net framework帮助文档!!! */
      

  12.   

    另外有一个设置,增量编译去掉,XML文档设置成与程序集名称一致,否则注释无法使用。
      

  13.   

    大伙们的意思是不是说,要在生成dll时,同时生成一个XML文件,这样在调用一个dll时,生明对象,调用方法和属性时就会出现注释了吗?我试一下,成功的话,立即结贴;呵呵,还有在IDE环境下怎么在生成DLL时同时生成一个.xml文档!
      

  14.   

             /// <summary>
    /// 按扭事件!
    /// </summary>
    /// <param name="sender">参数</param>
    /// <param name="e">参数2</param>
    private void button1_Click(object sender, System.EventArgs e)
    {

    }
    假如是dll的话。记住生成XML并记得忝加此文件到工程中!
    你要生成相应的XML文件。这样注释才能出来。
    你参看一下MSDN:)
    在 Visual Studio 开发环境中设置此编译器选项 打开项目的“属性页”对话框。有关详细信息,请参阅设置 Visual C# 项目属性。 
    单击“配置属性”文件夹。 
    单击“生成”属性页。 
    修改“XML 文档文件”属性。
    ****注意:生成一个和EXE文件名相同的XML文件。就OK了。
    请参看:ms-help://MS.VSCC/MS.MSDNVS.2052/cscomp/html/vcerrDocProcessDocumentationComments.htm我以前试了半天才搞定:)我试过了:)楼主20分好像太少了点吧!呵呵!