GetExportedTypes Method

Assembly.GetExportedTypes Method ()

 

Gets the public types defined in this assembly that are visible outside the assembly.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

Public Overridable Function GetExportedTypes As Type()

Return Value

Type: System.Type()

An array that represents the types defined in this assembly that are visible outside the assembly.

Exception Condition
NotSupportedException

The assembly is a dynamic assembly.

The only types visible outside an assembly are public types and public types nested within other public types.

The following code sample defines a number of classes with various access levels, and calls GetExportedTypes to display the ones that are visible from outside the assembly.

Imports System
Imports System.Reflection

Public Class Example
    Public Shared Sub Main()
        For Each t As Type In GetType(Example).Assembly.GetExportedTypes()
            Console.WriteLine(t)
        Next
    End Sub
End Class

Public Class PublicClass
    Public Class PublicNestedClass
    End Class

    Protected Class ProtectedNestedClass
    End Class

    Friend Class FriendNestedClass
    End Class

    Private Class PrivateNestedClass
    End Class
End Class

Friend Class FriendClass
    Public Class PublicNestedClass
    End Class

    Protected Class ProtectedNestedClass
    End Class

    Friend Class FriendNestedClass
    End Class

    Private Class PrivateNestedClass
    End Class
End Class

.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft