Gets the public types defined in this assembly that are visible outside the assembly.
Assembly: mscorlib (in mscorlib.dll)
Syntax array< System. . :: . Type> [] () []
An array that represents the types defined in this assembly that are visible outside the assembly.
. . :: . GetExportedTypes() () ()
Public Overridable Function GetExportedTypes As Type()public virtual Type[] GetExportedTypes()public:
virtual array<Type^>^ GetExportedTypes()abstract GetExportedTypes : unit -> Type[]
override GetExportedTypes : unit -> Type[] Return Value
Type:An array that represents the types defined in this assembly that are visible outside the assembly.
Implements
_Assembly Exceptions
| Exception | Condition |
|---|---|
| NotSupportedException | The assembly is a dynamic assembly. |
Examples
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 [Assembly].GetExecutingAssembly.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
using System;
using System.Reflection;
public class Example
{
public static void Main()
{
foreach (Type t in Assembly.GetExecutingAssembly().GetExportedTypes())
{
Console.WriteLine(t);
}
}
}
public class PublicClass
{
public class PublicNestedClass {}
protected class ProtectedNestedClass {}
internal class FriendNestedClass {}
private class PrivateNestedClass {}
}
internal class FriendClass
{
public class PublicNestedClass {}
protected class ProtectedNestedClass {}
internal class FriendNestedClass {}
private class PrivateNestedClass {}
}
using namespace System;
using namespace System::Reflection;
namespace ExportedClassExample
{
public ref class Example sealed
{
private:
Example()
{
}
public:
void static EnumerateExportedTypes()
{
for each (Type^ exportedType in
Assembly::GetExecutingAssembly()->GetExportedTypes())
{
Console::WriteLine(exportedType);
}
}
};
public ref class PublicClass
{
public:
ref class PublicNestedClass
{
};
protected:
ref class ProtectedNestedClass
{
};
internal:
ref class FriendNestedClass
{
};
private:
ref class PrivateNestedClass
{
};
};
ref class FriendClass
{
public:
ref class PublicNestedClass
{
};
protected:
ref class ProtectedNestedClass
{
};
internal:
ref class FriendNestedClass
{
};
private:
ref class PrivateNestedClass
{
};
};
}
int main()
{
ExportedClassExample::Example::EnumerateExportedTypes();
return 0;
}
Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.