Fetching Types, and Basic Reflection
mono_custom_attrs_get_attr
Syntax
MonoObject*
mono_custom_attrs_get_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass)
mono_reflection_assembly_get_assembly
Syntax
MonoAssembly*
mono_reflection_assembly_get_assembly (MonoReflectionAssembly *refassembly)
Parameters
refassembly | the System.Reflection.Assembly object |
Return value
the MonoAssembly*
associated with the C# System.Reflection.Assembly
object refassembly.
mono_reflection_free_type_info
Syntax
void
mono_reflection_free_type_info (MonoTypeNameParse *info)
mono_reflection_get_custom_attrs_blob
Syntax
MonoArray*
mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues)
Parameters
ctor | custom attribute constructor |
ctorArgs | arguments o the constructor |
properties | |
propValues | |
fields | |
fieldValues | |
Return value
a Byte
array representing the blob of data.
Description
Creates the blob of data that needs to be saved in the metadata and that represents
the custom attributed described by ctor, ctorArgs etc.
mono_reflection_get_custom_attrs_by_type
Syntax
MonoArray*
mono_reflection_get_custom_attrs_by_type (MonoObject *obj_raw, MonoClass *attr_klass, MonoError *error)
Parameters
obj | a reflection object handle |
Return value
an array with all the custom attributes defined of the
reflection handle obj. If attr_klass is non-NULL
, only custom attributes
of that type are returned. The objects are fully build. Return NULL
if a loading error
occurs.
mono_reflection_get_custom_attrs_data
Syntax
MonoArray*
mono_reflection_get_custom_attrs_data (MonoObject *obj_raw)
Parameters
obj | a reflection obj handle |
Return value
an array of System.Reflection.CustomAttributeData
,
which include information about attributes reflected on
types loaded using the Reflection Only methods
mono_reflection_get_custom_attrs
Syntax
MonoArray*
mono_reflection_get_custom_attrs (MonoObject *obj_raw)
Parameters
obj | a reflection object handle |
Return value
an array with all the custom attributes defined of the
reflection handle obj. The objects are fully build. Return NULL
if a loading error
occurs.
mono_reflection_get_token
Syntax
guint32
mono_reflection_get_token (MonoObject *obj_raw)
Return value
the metadata token of obj which should be an object
representing a metadata element.
mono_reflection_get_type
Syntax
MonoType*
mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve)
Parameters
image | a metadata context |
info | type description structure |
ignorecase | flag for case-insensitive string compares |
type_resolve | whenever type resolve was already tried |
Description
Build a MonoType from the type description in
info.
mono_reflection_parse_type
Syntax
int
mono_reflection_parse_type (char *name, MonoTypeNameParse *info)
mono_reflection_type_get_type
Syntax
MonoType*
mono_reflection_type_get_type (MonoReflectionType *reftype)
Parameters
reftype | the System.Type object |
Return value
the MonoType*
associated with the C# System.Type
object reftype.
mono_reflection_type_from_name
Syntax
MonoType*
mono_reflection_type_from_name (char *name, MonoImage *image)
Parameters
name | type name. |
image | a metadata context (can be NULL ). |
Description
Retrieves a
MonoType
from its
name. If the name is not fully qualified,
it defaults to get the type from
image or, if
image is
NULL
or loading
from it fails, uses corlib.
mono_reflection_get_custom_attrs_info
Syntax
MonoCustomAttrInfo*
mono_reflection_get_custom_attrs_info (MonoObject *obj_raw)
Parameters
obj | a reflection object handle |
Return value
the custom attribute info for attributes defined for the
reflection handle
obj. The objects.
FIXME this function leaks like a sieve for SRE objects.
Description
Custom Attributes
mono_custom_attrs_construct
Syntax
MonoArray*
mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo)
mono_custom_attrs_free
Syntax
void
mono_custom_attrs_free (MonoCustomAttrInfo *ainfo)
mono_custom_attrs_from_assembly
Syntax
MonoCustomAttrInfo*
mono_custom_attrs_from_assembly (MonoAssembly *assembly)
mono_custom_attrs_from_class
Syntax
MonoCustomAttrInfo*
mono_custom_attrs_from_class (MonoClass *klass)
mono_custom_attrs_from_event
Syntax
MonoCustomAttrInfo*
mono_custom_attrs_from_event (MonoClass *klass, MonoEvent *event)
mono_custom_attrs_from_field
Syntax
MonoCustomAttrInfo*
mono_custom_attrs_from_field (MonoClass *klass, MonoClassField *field)
mono_custom_attrs_from_index
Syntax
MonoCustomAttrInfo*
mono_custom_attrs_from_index (MonoImage *image, guint32 idx)
Return value
NULL
if no attributes are found or if a loading error occurs.
Description
mono_custom_attrs_from_method
Syntax
MonoCustomAttrInfo*
mono_custom_attrs_from_method (MonoMethod *method)
mono_custom_attrs_from_param
Syntax
MonoCustomAttrInfo*
mono_custom_attrs_from_param (MonoMethod *method, guint32 param)
Parameters
method | handle to the method that we want to retrieve custom parameter information from |
param | parameter number, where zero represent the return value, and one is the first parameter in the method |
Return value
the custom attribute object for the specified parameter, or NULL
if there are none.
Description
The result must be released with mono_custom_attrs_free().
mono_custom_attrs_from_property
Syntax
MonoCustomAttrInfo*
mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property)
mono_custom_attrs_has_attr
Syntax
gboolean
mono_custom_attrs_has_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass)
mono_module_file_get_object
Syntax
MonoReflectionModule*
mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index)
mono_module_get_object
Syntax
MonoReflectionModule*
mono_module_get_object (MonoDomain *domain, MonoImage *image)
mono_method_body_get_object
Syntax
MonoReflectionMethodBody*
mono_method_body_get_object (MonoDomain *domain, MonoMethod *method)
Parameters
domain | an app domain |
method | a method |
Return value
A System.Reflection.MethodBody/RuntimeMethodBody
object representing the method method.
mono_event_get_object
Syntax
MonoReflectionEvent*
mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event)
Parameters
domain | an app domain |
klass | a type |
event | a event |
Return value
A System.Reflection.MonoEvent
object representing the event event
in class klass.
mono_assembly_get_object
Syntax
MonoReflectionAssembly*
mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly)
Parameters
domain | an app domain |
assembly | an assembly |
Return value
a System.Reflection.Assembly
object representing the MonoAssembly
assembly.
mono_param_get_objects
Syntax
MonoArray*
mono_param_get_objects (MonoDomain *domain, MonoMethod *method)
mono_field_get_object
Syntax
MonoReflectionField*
mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field)
Parameters
domain | an app domain |
klass | a type |
field | a field |
Return value
A System.Reflection.MonoField
object representing the field field
in class klass.
mono_property_get_object
Syntax
MonoReflectionProperty*
mono_property_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error)
Parameters
domain | an app domain |
klass | a type |
property | a property |
error | set on error |
Return value
a System.Reflection.MonoProperty
object representing the property property
in class klass. On error returns NULL
and sets error.