IsDefined taking an Assembly as a parameter. : Assembly « Reflection « VB.Net Tutorial






Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

<Assembly: AssemblyDescription("A sample description")> 
Module DemoModule
    Sub Main()
        Dim assy As System.Reflection.Assembly = GetType(DemoModule).Assembly
        Dim assyName As String = assy.GetName().Name
        If Attribute.IsDefined(assy, GetType(AssemblyDescriptionAttribute)) Then
            Console.WriteLine(assyName)
            Dim attr As Attribute = Attribute.GetCustomAttribute(assy, GetType(AssemblyDescriptionAttribute))
            If Not attr Is Nothing And TypeOf attr Is AssemblyDescriptionAttribute Then
                Dim adAttr As AssemblyDescriptionAttribute = CType(attr, AssemblyDescriptionAttribute)
                Console.WriteLine(adAttr.Description)
            Else
                Console.WriteLine("The description could not be retrieved.")
            End If
        End If
    End Sub
End Module








19.8.Assembly
19.8.1.Loads an assembly named "example.exe" or "example.dll" into the current application domain
19.8.2.Fully qualified assembly name containing the specified class
19.8.3.IsDefined taking an Assembly as a parameter.
19.8.4.Get a type named Example from the assembly
19.8.5.Load an assembly into the current application domain