Type.GetTypeArray Method

Gets the types of the objects in the specified array.

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

static array<Type^>^ GetTypeArray (
	array<Object^>^ args
public static Type[] GetTypeArray (
	Object[] args
public static function GetTypeArray (
	args : Object[]
) : Type[]
Not applicable.



An array of objects whose types to determine.

Return Value

An array of Type objects representing the types of the corresponding elements in args.

Exception typeCondition


args is a null reference (Nothing in Visual Basic).


The class initializers are invoked and at least one throws an exception.

If a requested type is non-public and the caller does not have ReflectionPermission to non-public objects outside the current assembly, this method returns a null reference (Nothing in Visual Basic) for the corresponding element in the result array.

The following code example demonstrates how to use the GetTypeArray method to list the types of the elements of an array.

array<Object^>^myObject = gcnew array<Object^>(3);
myObject[ 0 ] = 66;
myObject[ 1 ] = "puri";
myObject[ 2 ] = 33.33;

// Get the array of 'Type' class objects.
array<Type^>^myTypeArray = Type::GetTypeArray( myObject );
Console::WriteLine( "Full names of the 'Type' objects in the array are:" );
for ( int h = 0; h < myTypeArray->Length; h++ )
   Console::WriteLine( myTypeArray[ h ]->FullName );


Object myObject[] = new Object[3];
myObject.set_Item(0, (System.Int32)66);
myObject.set_Item(1, "puri");
myObject.set_Item(2, (System.Double)33.33);
// Get the array of 'Type' class objects.
Type myTypeArray[] = Type.GetTypeArray(myObject);
Console.WriteLine("Full names of the 'Type' objects in the array are:");
for (int h = 0; h < myTypeArray.get_Length(); h++) {

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0