Freigeben über


Type.GetTypeArray-Methode

Ruft die Typen der Objekte im angegebenen Array ab.

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

Syntax

'Declaration
Public Shared Function GetTypeArray ( _
    args As Object() _
) As Type()
'Usage
Dim args As Object()
Dim returnValue As Type()

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

Parameter

  • args
    Ein Array von Objekten, deren Typen bestimmt werden sollen.

Rückgabewert

Ein Array von Type-Objekten, die die Typen der entsprechenden Elemente in args darstellen.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentNullException

args ist NULL (Nothing in Visual Basic).

TargetInvocationException

Die Klasseninitialisierungen wurden aufgerufen, und mindestens eine von ihnen hat eine Ausnahme ausgelöst.

Hinweise

Wenn ein angefragter Typ nicht öffentlich ist und der Aufrufer nicht über ReflectionPermission für nicht öffentliche Objekte außerhalb der aktuellen Assembly verfügt, gibt diese Methode bei den entsprechenden Elementen im Ergebnisarray NULL (Nothing in Visual Basic) zurück.

Beispiel

Dim myObject(2) As Object
myObject(0) = 66
myObject(1) = "puri"
myObject(2) = 33.33
' Get the array of 'Type' class objects.
Dim myTypeArray As Type() = Type.GetTypeArray(myObject)
Console.WriteLine("Full names of the 'Type' objects in the array are:")
Dim h As Integer
For h = 0 To myTypeArray.Length - 1
   Console.WriteLine(myTypeArray(h).FullName)
Next h
Object[] myObject = new Object[3];
myObject[0] = 66;
myObject[1] = "puri";
myObject[2] = 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.Length ; h++)
{
    Console.WriteLine(myTypeArray[h].FullName);
}
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());
}

Plattformen

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

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

Type-Klasse
Type-Member
System-Namespace
ReflectionPermission