Leer en inglés Editar

Compartir a través de


Type.GetTypeArray(Object[]) Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets the types of the objects in the specified array.

C#
public static Type[] GetTypeArray(object[] args);

Parameters

args
Object[]

An array of objects whose types to determine.

Returns

Type[]

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

Exceptions

args is null.

-or-

One or more of the elements in args is null.

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

Examples

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

C#
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);
}

Applies to

Producto Versiones
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1