C# Type GetTypeArray

Description

Type GetTypeArray gets the types of the objects in the specified array.

Syntax

Type.GetTypeArray has the following syntax.


public static Type[] GetTypeArray(
  Object[] args
)

Parameters

Type.GetTypeArray has the following parameters.

  • args - An array of objects whose types to determine.

Returns

Type.GetTypeArray method returns

Example

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


using System;//from ww  w .  j a v a  2 s.c  o m

public class MainClass{
  public static void Main(String[] argv){  
    Object[] myObject = new Object[3];
    myObject[0] = 66;
    myObject[1] = "java2s.com";
    myObject[2] = 33.33;

    Type[] myTypeArray = Type.GetTypeArray(myObject);
    for(int h = 0; h < myTypeArray.Length ; h++)
    {
        Console.WriteLine(myTypeArray[h].FullName);
    }

  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version