Description Attributes for class methods

  • Thread starter Sergey Poberezovskiy
  • Start date
S

Sergey Poberezovskiy

Hi,

I have already asked the question, but probably did not
make myself clear.

Back in VB6 days when you created a public
method/property/event you could define what's
called "Procedure Attributes", one of them was a
Description attribute. Once you define it, it would appear
in the Object Browser / Properties window for the consumer
of the component.

Now when we select a method/property in the Object Browser
we can often see "Summary" and sometimes "Parameters"
describing the method/property.

My question is how I can create these in my custom dll?

Any help would be greatly appreciated.

P.S. If you refer me to the DescriptionAttribute class,
please exxplain how to use it, as I have tried the example
from MSDN and it would not compile,
saying "Type 'Description' is not defined."
 
K

Klaus H. Probst

The Description attribute is under the System.ComponentModel namespace, so
you need to add an Imports statement that allows the compiler to see it.
After that the samples you have should work. For example:

Imports System.Runtime.InteropServices
....

Public Class MClass

<Description("This function does something")> _
Public Function MyFunction() As Integer

End Function

End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top