GetTypeArray Method

Type.GetTypeArray Method

Gets the types of the objects in the specified array.

[Visual Basic]
Public Shared Function GetTypeArray( _
   ByVal args() As Object _
) As Type()
public static Type[] GetTypeArray(
 object[] args
public: static Type* GetTypeArray(
 Object* args __gc[]
) [];
public static function GetTypeArray(
   args : Object[]
) : Type[];


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 Type Condition
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.


[Visual Basic] 
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
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++)

Object* myObject[] = new Object*[3];
myObject->Item[0] = __box(66);
myObject->Item[1] = S"puri";
myObject->Item[2] = __box(33.33);
// Get the array of 'Type' class objects.
Type*  myTypeArray[] = Type::GetTypeArray(myObject);
Console::WriteLine(S"Full names of the 'Type' objects in the array are:");
for (int h = 0; h < myTypeArray->Length ; h++) {

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

Type Class | Type Members | System Namespace | ReflectionPermission

© 2015 Microsoft