Assembly.GetExportedTypes Method

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

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

public virtual Type[] GetExportedTypes()

Return Value

Type: System.Type []
An array of Type objects that represent the types defined in this assembly that are visible outside the 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.


using System;
using System.Reflection;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      foreach (Type t in Assembly.GetExecutingAssembly().GetExportedTypes())
      {
         outputBlock.Text += t + "\n";
      }
   }
}

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 { }
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft