mono-api-class.html
Class Operations
mono_class_array_element_size
gint32
mono_class_array_element_size (MonoClass *klass)
Parameters
klass:
Returns
the number of bytes an element of type klass
uses when stored into an array.
mono_class_data_size
gint32
mono_class_data_size (MonoClass *klass)
Parameters
klass: a class
Returns
the size of the static class data
Remarks
mono_class_enum_basetype
MonoType*
mono_class_enum_basetype (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the underlying type representation for an enumeration.
mono_class_from_generic_parameter
MonoClass*
mono_class_from_generic_parameter (MonoGenericParam *param, MonoImage *arg2 G_GNUC_UNUSED, gboolean arg3 G_GNUC_UNUSED)
Parameters
param: Parameter to find/construct a class for.arg2: Is ignored.arg3: Is ignored.
mono_class_from_mono_type
Prototype: mono_class_from_mono_type
mono_class_from_name_case
MonoClass*
mono_class_from_name_case (MonoImage *image, const char* name_space, const char *name)
Parameters
image: The MonoImage where the type is looked up inname_space: the type namespacename: the type short name.deprecated: use the _checked variant
Remarks
Obtains a MonoClass with a given namespace and a given name which
is located in the given MonoImage. The namespace and name
lookups are case insensitive.
mono_class_from_name
MonoClass*
mono_class_from_name (MonoImage *image, const char* name_space, const char *name)
Parameters
image: The MonoImage where the type is looked up inname_space: the type namespacename: the type short name.
Remarks
Obtains a MonoClass with a given namespace and a given name which
is located in the given MonoImage.
To reference nested classes, use the "/" character as a separator.
For example use "Foo/Bar" to reference the class Bar that is nested
inside Foo, like this: "class Foo { class Bar {} }".
mono_class_from_typeref
Prototype: mono_class_from_typeref
mono_class_get_byref_type
MonoType*
mono_class_get_byref_type (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Remarks
mono_class_get_element_class
MonoClass*
mono_class_get_element_class (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the element class of an array or an enumeration.
mono_class_get_events
MonoEvent*
mono_class_get_events (MonoClass* klass, gpointer *iter)
Parameters
klass: the MonoClass to act on
Returns
a MonoEvent* on each invocation, or NULL when no more are available.
Remarks
This routine is an iterator routine for retrieving the properties in a class.
You must pass a gpointer that points to zero and is treated as an opaque handle to
iterate over all of the elements. When no more values are
available, the return value is NULL.
mono_class_get_event_token
Prototype: mono_class_get_event_token
mono_class_get_field_from_name
MonoClassField*
mono_class_get_field_from_name (MonoClass *klass, const char *name)
Parameters
klass: the class to lookup the field.name: the field name
Returns
the MonoClassField pointer of the named field or NULL
Remarks
Search the class
klass and it's parents for a field with the name
name.
mono_class_get_field
MonoClassField*
mono_class_get_field (MonoClass *klass, guint32 field_token)
Parameters
class: the class to lookup the field.field_token: the field token
Returns
A MonoClassField representing the type and offset of
the field, or a NULL value if the field does not belong to this
class.
mono_class_get_fields
MonoClassField*
mono_class_get_fields (MonoClass* klass, gpointer *iter)
Parameters
klass: the MonoClass to act on
Returns
a MonoClassField* on each iteration, or NULL when no more fields are available.
Remarks
This routine is an iterator routine for retrieving the fields in a class.
You must pass a gpointer that points to zero and is treated as an opaque handle to
iterate over all of the elements. When no more values are
available, the return value is NULL.
mono_class_get_field_token
guint32
mono_class_get_field_token (MonoClassField *field)
Parameters
field: the field we need the token of
Returns
the token representing the field in the image it was loaded from.
Remarks
Get the token of a field. Note that the tokesn is only valid for the image
the field was loaded from. Don't use this function for fields in dynamic types.
mono_class_get_flags
guint32
mono_class_get_flags (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the flags from the TypeDef table.
Remarks
The type flags from the TypeDef table from the metadata.
see the TYPE_ATTRIBUTE_* definitions on tabledefs.h for the
different values.
mono_class_get_full
MonoClass*
mono_class_get_full (MonoImage *image, guint32 type_token, MonoGenericContext *context)
Parameters
image: the image where the class residestype_token: the token for the classcontext: the generic context used to evaluate generic instantiations indeprecated: Functions that expose MonoGenericContext are going away in mono 4.0
Returns
the MonoClass that represents type_token in image
mono_class_get_image
Prototype: mono_class_get_image
mono_class_get_interfaces
MonoClass*
mono_class_get_interfaces (MonoClass* klass, gpointer *iter)
Parameters
klass: the MonoClass to act on
Returns
a Monoclass* on each invocation, or NULL when no more are available.
Remarks
This routine is an iterator routine for retrieving the interfaces implemented by this class.
You must pass a gpointer that points to zero and is treated as an opaque handle to
iterate over all of the elements. When no more values are
available, the return value is NULL.
mono_class_get_method_from_name
MonoMethod*
mono_class_get_method_from_name (MonoClass *klass, const char *name, int param_count)
Parameters
klass: where to look for the methodname: name of the methodparam_count: number of parameters. -1 for any number.
Remarks
Obtains a MonoMethod with a given name and number of parameters.
It only works if there are no multiple signatures for any given method name.
mono_class_get_methods
MonoMethod*
mono_class_get_methods (MonoClass* klass, gpointer *iter)
Parameters
klass: the MonoClass to act on
Returns
a MonoMethod on each iteration or NULL when no more methods are available.
Remarks
This routine is an iterator routine for retrieving the fields in a class.
You must pass a gpointer that points to zero and is treated as an opaque handle to
iterate over all of the elements. When no more values are
available, the return value is NULL.
mono_class_get
Prototype: mono_class_get
mono_class_get_name
const char*
mono_class_get_name (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the name of the class.
mono_class_get_namespace
const char*
mono_class_get_namespace (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the namespace of the class.
mono_class_get_nested_types
MonoClass*
mono_class_get_nested_types (MonoClass* klass, gpointer *iter)
Parameters
klass: the MonoClass to act on
Returns
a Monoclass* on each invocation, or NULL when no more are available.
Remarks
This routine is an iterator routine for retrieving the nested types of a class.
This works only if
klass is non-generic, or a generic type definition.
You must pass a gpointer that points to zero and is treated as an opaque handle to
iterate over all of the elements. When no more values are
available, the return value is NULL.
mono_class_get_nesting_type
Prototype: mono_class_get_nesting_type
mono_class_get_parent
MonoClass*
mono_class_get_parent (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the parent class for this class.
mono_class_get_properties
MonoProperty*
mono_class_get_properties (MonoClass* klass, gpointer *iter)
Parameters
klass: the MonoClass to act on
Returns
a MonoProperty* on each invocation, or NULL when no more are available.
Remarks
This routine is an iterator routine for retrieving the properties in a class.
You must pass a gpointer that points to zero and is treated as an opaque handle to
iterate over all of the elements. When no more values are
available, the return value is NULL.
mono_class_get_property_from_name
Prototype: mono_class_get_property_from_name
mono_class_get_property_token
Prototype: mono_class_get_property_token
mono_class_get_rank
int
mono_class_get_rank (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the rank for the array (the number of dimensions).
mono_class_get_type
MonoType*
mono_class_get_type (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the MonoType from the class.
Remarks
This method returns the internal Type representation for the class.
mono_class_inflate_generic_method
Prototype: mono_class_inflate_generic_method
mono_class_inflate_generic_type
Prototype: mono_class_inflate_generic_type
mono_class_init
gboolean
mono_class_init (MonoClass *klass)
Parameters
class: the class to initialize
Remarks
Compute the instance_size, class_size and other infos that cannot be
computed at mono_class_get() time. Also compute vtable_size if possible.
Returns TRUE on success or FALSE if there was a problem in loading
the type (incorrect assemblies, missing assemblies, methods, etc).
LOCKING: Acquires the loader lock.
mono_class_instance_size
gint32
mono_class_instance_size (MonoClass *klass)
Parameters
klass: a class
Returns
the size of an object instance
Remarks
mono_class_is_assignable_from
gboolean
mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass)
Parameters
klass: the class to be assigned tooklass: the source class
Returns
true if an instance of object oklass can be assigned to an
instance of object klass
mono_class_is_enum
gboolean
mono_class_is_enum (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
true if the MonoClass represents an enumeration.
mono_class_is_subclass_of
gboolean
mono_class_is_subclass_of (MonoClass *klass, MonoClass *klassc,
gboolean check_interfaces)
Parameters
klass: class to probe if it is a subclass of another oneklassc: the class we suspect is the base classcheck_interfaces: whether we should perform interface checks
Remarks
This method determines whether
klass is a subclass of
klassc.
If the
check_interfaces flag is set, then if
klassc is an interface
this method return true if the
klass implements the interface or
if
klass is an interface, if one of its base classes is
klass.
If
check_interfaces is false then, then if
klass is not an interface
then it returns true if the
klass is a subclass of
klassc.
if
klass is an interface and
klassc is System.Object, then this function
return true.
mono_class_is_valuetype
gboolean
mono_class_is_valuetype (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
true if the MonoClass represents a ValueType.
mono_class_min_align
gint32
mono_class_min_align (MonoClass *klass)
Parameters
klass: a class
Returns
minimm alignment requirements
Remarks
mono_class_num_events
int
mono_class_num_events (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the number of events in the class.
mono_class_num_fields
int
mono_class_num_fields (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the number of static and instance fields in the class.
mono_class_num_methods
int
mono_class_num_methods (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the number of methods in the class.
mono_class_num_properties
int
mono_class_num_properties (MonoClass *klass)
Parameters
klass: the MonoClass to act on
Returns
the number of properties in the class.
mono_class_value_size
gint32
mono_class_value_size (MonoClass *klass, guint32 *align)
Parameters
klass: a class
Returns
the size of a value of kind klass
Remarks
This function is used for value types, and return the
space and the alignment to store that kind of value object.
mono_class_vtable
MonoVTable*
mono_class_vtable (MonoDomain *domain, MonoClass *klass)
Parameters
domain: the application domainclass: the class to initialize
Remarks
VTables are domain specific because we create domain specific code, and
they contain the domain specific static class data.
On failure, NULL is returned, and class->exception_type is set.
mono_class_get_method_from_name_flags
MonoMethod*
mono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int param_count, int flags)
Parameters
klass: where to look for the methodname_space: name of the methodparam_count: number of parameters. -1 for any number.flags: flags which must be set in the method
Remarks
Obtains a MonoMethod with a given name and number of parameters.
It only works if there are no multiple signatures for any given method name.