Type.GetTypeArray(Object[]) Metoda

Definice

Získá typy objektů v zadaném poli.

public:
 static cli::array <Type ^> ^ GetTypeArray(cli::array <System::Object ^> ^ args);
public static Type[] GetTypeArray (object[] args);
static member GetTypeArray : obj[] -> Type[]
Public Shared Function GetTypeArray (args As Object()) As Type()

Parametry

args
Object[]

Pole objektů, jejichž typy určit.

Návraty

Type[]

Pole objektů Type představující typy odpovídajících prvků v objektu args .

Výjimky

args je null.

-nebo- Jeden nebo více prvků v je args null .

Inicializátory třídy jsou vyvolány a alespoň jeden vyvolá výjimku.

Příklady

Následující příklad kódu ukazuje, jak použít GetTypeArray metodu k výpisu typů prvků pole.

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[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);
}
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

Platí pro