Export (0) Print
Expand All
Expand Minimize

Type.GetTypeArray Method

Gets the types of the objects in the specified array.

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

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

Parameters

args

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

ArgumentNullException

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

TargetInvocationException

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.

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++) {
    Console.WriteLine(myTypeArray[h].get_FullName());
}

Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft