如何向vb.net中的用户控件属性添加描述

时间:2022-10-27 00:02:37

I created one web user control with property named "ReadonlyField" with boolean datatype. I am able to use in my web pages and now I wanted to add a description to that property so that I don't need to explain each time to my team member what is that property's intention.

我创建了一个web用户控件,其属性名为“ReadonlyField”,带有布尔数据类型。我可以在我的网页中使用,现在我想给该属性添加一个描述,这样我就不需要每次向我的团队成员解释这个属性的意图是什么。

I got following snippet in c# but didnt find any equivalent in vb.net and also not sure whether it will work or not.

我在c#中得到了下面的代码片段,但是在vb.net中没有找到任何对等的代码,也不确定它是否有效。

[Description("My Description")]
public int MyIntProperty
{
    get {..}
    set {..}
}

2 个解决方案

#1


2  

A literal translation in VB 10

VB 10中的直译

<Description("My Description")> Public Property MyIntProperty As Integer

If this is for other programmers you may want to offer Intellisense support via XML comments. This is the standard way of doing it in both VB and C#.

如果是其他程序员,您可能希望通过XML注释提供智能感知支持。这是在VB和c#中使用的标准方法。

VB

VB

 ''' <summary>
 ''' Description goes here
 ''' </summary>
 ''' <value></value>
 ''' <returns></returns>
 ''' <remarks></remarks>
 Public Property MyIntProperty As Integer

#2


0  

Actually, I put mine into the summary block, and then it shows in Intellisense...

实际上,我把我的东西放到了summary块中,然后它显示在Intellisense中…

 ''' <summary>
 ''' Returns "INSTALLATION ACTION INITIATED"
 ''' </summary>
 ''' <value></value>
 ''' <returns></returns>
 ''' <remarks></remarks>
 Public ReadOnly Property IAS
     Get
         Return _dict("IAS")
     End Get
 End Property

#1


2  

A literal translation in VB 10

VB 10中的直译

<Description("My Description")> Public Property MyIntProperty As Integer

If this is for other programmers you may want to offer Intellisense support via XML comments. This is the standard way of doing it in both VB and C#.

如果是其他程序员,您可能希望通过XML注释提供智能感知支持。这是在VB和c#中使用的标准方法。

VB

VB

 ''' <summary>
 ''' Description goes here
 ''' </summary>
 ''' <value></value>
 ''' <returns></returns>
 ''' <remarks></remarks>
 Public Property MyIntProperty As Integer

#2


0  

Actually, I put mine into the summary block, and then it shows in Intellisense...

实际上,我把我的东西放到了summary块中,然后它显示在Intellisense中…

 ''' <summary>
 ''' Returns "INSTALLATION ACTION INITIATED"
 ''' </summary>
 ''' <value></value>
 ''' <returns></returns>
 ''' <remarks></remarks>
 Public ReadOnly Property IAS
     Get
         Return _dict("IAS")
     End Get
 End Property