Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))

LoadedAssemblies Property

Location

My.Application.Info.LoadedAssemblies

Syntax

Dim result As System.Collections.ObjectModel. _ ReadOnlyCollection(Of System.Reflection.Assembly) = _ My.Application.Info.LoadedAssemblies

Description

The LoadedAssemblies property returns a collection of all assemblies currently loaded by the active application, with each element of type System.Reflection.Assembly.

Usage at a Glance

  • This property is read-only.

  • An application may include multiple loaded assemblies, including the primary application assembly and associated libraries (DLLs).

  • An exception is thrown if the application domain is not loaded.

Example

The following example displays the names of all currently loaded assemblies in a message box.

Dim assemblyList As String = "" Dim allAssemblies As System.Collections.ObjectModel. _ ReadOnlyCollection(Of System.Reflection.Assembly) = _ My.Application.Info.LoadedAssemblies For Each oneAssembly As System.Reflection.Assembly _ In allAssemblies assemblyList &= "|" & oneAssembly.FullName Next oneAssembly MsgBox("The following assemblies are currently loaded:" & _ Replace(assemblyList, "|", vbCrLf))

Related Framework Entries

  • Microsoft.VisualBasic.ApplicationServices.AssemblyInfo.LoadedAssemblies Property

  • System.AppDomain.GetAssemblies Method

See Also

AssemblyName Property, DirectoryPath Property, Info Object (My.Application)

Категории