Mega Code Archive

 
Categories / VB.Net / Reflection
 

Assembly IsDefined tells whether or not a specified attribute has been applied to the assembly

Imports System Imports System.Reflection <Assembly:AssemblyTitleAttribute("A title example")> Public Class Test     Public Shared Sub Main()         Dim asm As [Assembly] = [Assembly].GetCallingAssembly         Dim aType As Type = GetType(AssemblyTitleAttribute)         Console.WriteLine(asm.IsDefined(aType, false))         aType = GetType(AssemblyVersionAttribute)         Console.WriteLine(asm.IsDefined(aType, false))     End Sub End Class