## Type support

### Synopsis

#include <metadata/metadata.h> #include <metadata/class.h> typedef struct _MonoType MonoType; mono_type_get_object mono_type_create_from_typespec mono_type_full_name MonoArrayType* mono_type_get_array_type (MonoType *type); MonoClass* mono_type_get_class (MonoType *type); mono_type_get_modifiers char* mono_type_get_name (MonoType *type); MonoType* mono_type_get_ptr_type (MonoType *type); MonoMethodSignature* mono_type_get_signature (MonoType *type); int mono_type_get_type (MonoType *type); mono_type_get_underlying_type gboolean mono_type_is_byref (MonoType *type); mono_bool mono_type_is_pointer (MonoType *type); mono_bool mono_type_is_reference (MonoType *type); mono_bool mono_type_is_struct (MonoType *type); mono_bool mono_type_is_void (MonoType *type); mono_type_size mono_type_stack_size guint32 mono_type_to_unmanaged (MonoType *type, MonoMarshalSpec *mspec, gboolean as_field; mono_type_generic_inst_is_valuetype

The MonoType represents the unmanaged version of System.Type.
`mono_type_get_object`
Syntax
mono_type_get_object

`mono_type_create_from_typespec`
Syntax
mono_type_create_from_typespec

`mono_type_full_name`
Syntax
mono_type_full_name

`mono_type_get_array_type`
Syntax
MonoArrayType* mono_type_get_array_type (MonoType *type)

Parameters

type | the MonoType operated on

Return value
a MonoArrayType struct describing the array type that type represents. The info includes details such as rank, array element type and the sizes and bounds of multidimensional arrays.
Description

It is only valid to call this function if type is a MONO_TYPE_ARRAY.

`mono_type_get_class`
Syntax
MonoClass* mono_type_get_class (MonoType *type)

Parameters

type | the MonoType operated on

Return value
the MonoClass pointer that describes the class that type represents.
Description

It is only valid to call this function if type is a MONO_TYPE_CLASS or a MONO_TYPE_VALUETYPE. For more general functionality, use mono_class_from_mono_type (), instead

`mono_type_get_modifiers`
Syntax
mono_type_get_modifiers

`mono_type_get_name`
Syntax
char* mono_type_get_name (MonoType *type)

Parameters

type | a type

Return value
The string representation for type as it would be represented in IL code.
Description

`mono_type_get_ptr_type`
Syntax
MonoType* mono_type_get_ptr_type (MonoType *type)

Parameters

type | the MonoType operated on

Return value
the MonoType pointer that describes the type that type represents a pointer to.
Description

It is only valid to call this function if type is a MONO_TYPE_PTR. instead

`mono_type_get_signature`
Syntax
MonoMethodSignature* mono_type_get_signature (MonoType *type)

Parameters

type | the MonoType operated on

Return value
the MonoMethodSignature pointer that describes the signature of the function pointer type represents.
Description

It is only valid to call this function if type is a MONO_TYPE_FNPTR.

`mono_type_get_type`
Syntax
int mono_type_get_type (MonoType *type)

Parameters

type | the MonoType operated on

Return value
the IL type value for type. This is one of the MonoTypeEnum enum members like MONO_TYPE_I4 or MONO_TYPE_STRING.
Description

`mono_type_get_underlying_type`
Syntax
mono_type_get_underlying_type

`mono_type_is_byref`
Syntax
gboolean mono_type_is_byref (MonoType *type)

Parameters

type | the MonoType operated on

Return value
#`TRUE` if type represents a type passed by reference, #`FALSE` otherwise.
Description

`mono_type_is_pointer`
Syntax
mono_bool mono_type_is_pointer (MonoType *type)

Parameters

type | the MonoType operated on

Return value
#`TRUE` is type is a managed or unmanaged pointer type. #`FALSE` otherwise.
Description

`mono_type_is_reference`
Syntax
mono_bool mono_type_is_reference (MonoType *type)

Parameters

type | the MonoType operated on

Return value
#`TRUE` is type represents an object reference . #`FALSE` otherwise.
Description

`mono_type_is_struct`
Syntax
mono_bool mono_type_is_struct (MonoType *type)

Parameters

type | the MonoType operated on

Return value
#`TRUE` is type is a struct, that is a ValueType but not en enum or a basic type like System.Int32. #`FALSE` otherwise.
Description

`mono_type_is_void`
Syntax
mono_bool mono_type_is_void (MonoType *type)

Parameters

type | the MonoType operated on

Return value
#`TRUE` is type is System.Void. #`FALSE` otherwise.
Description

`mono_type_size`
Syntax
mono_type_size

`mono_type_stack_size`
Syntax
mono_type_stack_size

`mono_type_to_unmanaged`
Syntax
guint32 mono_type_to_unmanaged (MonoType *type, MonoMarshalSpec *mspec, gboolean as_field, gboolean unicode, MonoMarshalConv *conv)

Return value
A MonoMarshalNative enumeration value (MONO_NATIVE_) value describing the underlying native reprensetation of the type.

In addition the value pointed by "conv" will contain the kind of marshalling required for this particular type one of the MONO_MARSHAL_CONV_ enumeration values.
Description