System.Type[] GenericArguments { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The GenericArguments property of the TypeDescription class provides access to the generic parameters of a type if it is a generic type. This property returns an array of System.Type objects, each representing a generic parameter of the type.

Usage

Use the GenericArguments property when you need to inspect the generic parameters of a type described by a TypeDescription instance. This is particularly useful when working with generic types and you need to understand or manipulate their type parameters.

Example

// Example of accessing GenericArguments
TypeDescription typeDescription = TypeLibrary.GetTypeDescription(typeof(List<>));

if (typeDescription.IsGenericType)
{
    System.Type[] genericArgs = typeDescription.GenericArguments;
    foreach (var arg in genericArgs)
    {
        // Output the name of each generic argument
        Console.WriteLine(arg.Name);
    }
}