Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
In VB6 I used the TypeLib Information dll (tlbinf32.dll) to find out about the classes contained in a plug-in Class Library. Is that still the best way to do it in .net?
Posted
You could find out about the assembly version, possibly the culture, and other things that are assembly specific. You could also findout the types within the assembly, the methods, properties, and attributes of each type in the assembly. If a type has a field named description, you could find that out- but I don't think anybody would do that.
  • Leaders
Posted

If you are the person writing the class then you could supply a System.ComponentModel.DescriptionAttribute for a class and extract that attribute from the DLL with reflection.

[vB]

'Supply a description

<System.ComponentModel.Description("A class that I made.")> _

Public Class My_Class

 

'This function will load and display the description

Public Shared Sub LoadAndDisplayAttribute

Dim ClassType As System.Type = GetType(My_Class)

'Get a list of description attributes

Dim Attributes As Object() = ClassType.GetCustomAttributes( _

GetType(System.ComponentModel.DescriptionAttribute), False)

 

If Attributes.Length > 0 Then

'Only one description attribute may be applied to a class definition,

'so we will assume that our description is Attributes(0)

MessageBox.Show(CType(Attributes(0), System.ComponentModel.DescriptionAttribute).Description)

End If

End Sub

End Class

[/code]

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...