类之前的
///Summary就是说明。
///Summary就是说明。
解决方案 »
- C#调用VC动态库函数,出现奇怪问题,传入的第二个参数值,成了第三个参数的值。(附代码)
- 匹配数字~
- Convert.ToDouble(string)方法中,如果string的首字符为“-”(符号),就出错,请问怎么办?
- c#中如何求得数组元素个数
- DevExpress xpo 的dataobject 用什么工具生产的?
- 请问在一个水晶报表格式里放多个表的解决办法 急!!!
- 在C#中,是否有一个简单方法取消 ListView.SelectedItems中所有挑选的条目?
- 这个效果这么实现,关于interface的问题
- 水晶报表无法打印!!急~~
- 如何继承窗口
- 请求帮助!反序列化错误
- 如何移动无模式窗体?
class YourClass
[Description("la..la..la..lala")] 定制你的属性的描述
public string Name{get;}
[Description("设置在注册表启动项中键名的属性")]
public string RegName
{
get
{return regName;}
set
{regName=value;}
}
F:\projects\StartWithReg\StartWithComputer.cs(72): 找不到类型或命名空间名称“Description”(是否缺少 using 指令或程序集引用?)
怎么会这样呢.大家给我说清楚点,好吗?
最好能帧出代码来.谢谢了
[Description("关闭注册表"),Category("Appearance")]
public void CloseReg()
{
StartPath.Close();
STARTWITH.Close();
}可是不行啊
我在另一个工程中引用这个库文件,可是在实例化对象后,调用这个方法时,并不出现"关闭注册表的提示"啊,大哥们能提供个例子吗?
public string RegName
{
get
{return regName;}
set
{regName=value;}
}
上面这一种,偶试过好几次都不行.
"在任何一个元素前面写说明的时候,输入"///",系统就会自动把一个XML标准的说明框架列出来,然后在其中的<summary>段中写说明,这样在引用这个类或者函数的时候,鼠标旁边的提示中就会有他的说明了。"这个如果在同个工程中调用另一类的对象是可以的,确实可以能达到所要的效果.可是我把一个类输出为dll文件,然后在另一工程中引用它时,就不行了,
还有高手能指点一下吗?
<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);
/// 函数介绍
/// </summary>
/// <PARAM name="参数名"></PARAM>
/// 参数说明
==========================
[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帮助文档!!! */
/// 按扭事件!
/// </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分好像太少了点吧!呵呵!