Assembly Class
Assembly: mscorlib (in mscorlib.dll)
'Declaration <SerializableAttribute> _ <ClassInterfaceAttribute(ClassInterfaceType.None)> _ <ComVisibleAttribute(True)> _ Public Class Assembly Implements _Assembly, IEvidenceFactory, ICustomAttributeProvider, ISerializable 'Usage Dim instance As Assembly
/** @attribute SerializableAttribute() */ /** @attribute ClassInterfaceAttribute(ClassInterfaceType.None) */ /** @attribute ComVisibleAttribute(true) */ public class Assembly implements _Assembly, IEvidenceFactory, ICustomAttributeProvider, ISerializable
SerializableAttribute ClassInterfaceAttribute(ClassInterfaceType.None) ComVisibleAttribute(true) public class Assembly implements _Assembly, IEvidenceFactory, ICustomAttributeProvider, ISerializable
Assemblies provide the infrastructure that allows the runtime to fully understand the contents of an application and to enforce the versioning and dependency rules defined by the application. These concepts are crucial for solving the versioning problem and for simplifying the deployment of runtime applications.
The following code example lists the method signatures for each method in an assembly.
' LoadInvoke loads MyAssembly.dll and lists the method ' information for each method. After compiling this class, ' run LoadInvoke.exe with the DisplayName for the assembly, ' as shown here: ' LoadInvoke MyAssembly Imports System Imports System.Reflection Imports System.Security.Permissions Public Class LoadInvoke <PermissionSetAttribute(SecurityAction.Demand, Name:="FullTrust")> _ Public Shared Sub Main(ByVal args() As String) Dim a As [Assembly] = [Assembly].Load(args(0)) Dim mytypes As Type() = a.GetTypes() Dim flags As BindingFlags = BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.Static Or _ BindingFlags.Instance Or BindingFlags.DeclaredOnly Dim t As Type For Each t In mytypes Dim mi As MethodInfo() = t.GetMethods(flags) Dim obj As [Object] = Activator.CreateInstance(t) Dim m As MethodInfo For Each m In mi ' Instead of invoking the methods, ' it's safer to initially just list them. Console.WriteLine(m) Next m Next t End Sub End Class
' Use this class with the LoadInvoke program. ' Compile this class using vbc /t:library MyAssembly.vb ' to obtain MyAssembly.dll. Imports System Imports Microsoft.VisualBasic Public Class MyAssembly Public Sub MyMethod1() Console.WriteLine("Invoking MyAssembly.MyMethod1") End Sub 'MyMethod1 End Class 'MyAssembly
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.