<?xml version="1.0" encoding="us-ascii"?><span> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>mono-api-object.html</title> <style type="text/css"> h3 { font-size: 18px; padding-bottom: 4pt; border-bottom: 2px solid #dddddd; } .api { border: 1px solid; padding: 10pt; margin: 10pt; } .api-entry { border-bottom: none; font-size: 18px; } .prototype { border: 1px solid; background-color: #f2f2f2; padding: 5pt; margin-top: 5pt; margin-bottom: 5pt; } .header { border: 1px solid; padding: 0 0 5pt 5pt; margin: 10pt; white-space: pre; font-family: monospace; } .code { border: 1px solid; padding: 0 0 5pt 5pt; margin: 10pt; white-space: pre; font-family: monospace; } </style> </head> <body> <h1>Object API</h1> <p />The object API deals with all the operations shared by <a href="#objects">objects</a>, <a href="#valuetypes">value types</a>, <a href="#arrays">arrays</a> and <a href="#nullable">nullable types</a>. <p />The object API has methods for accessing <a href="#fields">fields</a>, <a href="#properties">properties</a>, <a href="#events">events</a>, <a href="#delegates">delegates</a>. <p />There are some advanced uses that are useful to document here dealing with <a href="#async">AsyncResults</a> and <a href="#remote">remote fields</a>. <h2>Synopsis</h2> <div class="header"> #include <metadata/object.h> typedef struct MonoVTable MonoVTable; typedef struct _MonoThreadsSync MonoThreadsSync; typedef struct { MonoVTable *vtable; MonoThreadsSync *synchronisation; } MonoObject; typedef struct { guint32 length; guint32 lower_bound; } MonoArrayBounds; typedef struct { MonoObject obj; /* bounds is NULL for szarrays */ MonoArrayBounds *bounds; /* total number of elements of the array */ guint32 max_length; /* we use double to ensure proper alignment on platforms that need it */ double vector [MONO_ZERO_LEN_ARRAY]; } MonoArray; MonoObject* <a href="#api:mono_object_new">mono_object_new</a> (MonoDomain *domain, MonoClass *klass); <a href="#api:mono_object_new_alloc_specific"></a> <a href="#api:mono_object_new_fast"></a> MonoObject* <a href="#api:mono_object_new_from_token">mono_object_new_from_token</a> (MonoDomain *domain, MonoImage *image, guint32 token); MonoObject* <a href="#api:mono_object_new_specific">mono_object_new_specific</a> (MonoVTable *vtable); MonoObject* <a href="#api:mono_object_clone">mono_object_clone</a> (MonoObject *obj); MonoClass* <a href="#api:mono_object_get_class">mono_object_get_class</a> (MonoObject *obj); MonoDomain* <a href="#api:mono_object_get_domain">mono_object_get_domain</a> (MonoObject *obj); MonoMethod* <a href="#api:mono_object_get_virtual_method">mono_object_get_virtual_method</a> (MonoObject *obj, MonoMethod *method); <a href="#api:mono_object_isinst_mbyref"></a> MonoObject* <a href="#api:mono_object_isinst">mono_object_isinst</a> (MonoObject *obj, MonoClass *klass); void <a href="#api:mono_object_register_finalizer">mono_object_register_finalizer</a> (MonoObject *obj); gpointer <a href="#api:mono_object_unbox">mono_object_unbox</a> (MonoObject *obj); MonoObject* <a href="#api:mono_object_castclass_mbyref">mono_object_castclass_mbyref</a> (MonoObject *obj, MonoClass *klass); <a href="#api:mono_object_is_alive"></a> guint <a href="#api:mono_object_get_size">mono_object_get_size</a> (MonoObject* o); MonoObject* <a href="#api:mono_value_box">mono_value_box</a> (MonoDomain *domain, MonoClass *class, gpointer value); <a href="#api:mono_value_copy"></a> <a href="#api:mono_value_copy_array"></a> MonoArray* <a href="#api:mono_array_new">mono_array_new</a> (MonoDomain *domain, MonoClass *eclass, mono_array_size_t n); MonoArray* <a href="#api:mono_array_new_full">mono_array_new_full</a> (MonoDomain *domain, MonoClass *array_class, mono_array_size_t *lengths, mono_array_size_t *lower_bounds); MonoArray* <a href="#api:mono_array_new_specific">mono_array_new_specific</a> (MonoVTable *vtable, mono_array_size_t n); MonoClass* <a href="#api:mono_array_class_get">mono_array_class_get</a> (MonoClass *eclass, guint32 rank); MonoArray* <a href="#api:mono_array_clone_in_domain">mono_array_clone_in_domain</a> (MonoDomain *domain, MonoArray *array); MonoArray* <a href="#api:mono_array_clone">mono_array_clone</a> (MonoArray *array); void <a href="#api:mono_array_full_copy">mono_array_full_copy</a> (MonoArray *src, MonoArray *dest); <a href="#api:mono_array_to_lparray"></a> <a href="#api:mono_array_to_savearray"></a> <a href="#api:mono_dup_array_type"></a> <a href="#api:mono_array_set"></a> <a href="#api:mono_array_setref"></a> <a href="#api:mono_array_length"></a> <a href="#api:mono_array_addr"></a> <a href="#api:mono_array_addr_with_size"></a> <a href="#api:mono_array_get"></a> gint32 <a href="#api:mono_array_element_size">mono_array_element_size</a> (MonoClass *ac); <a href="#api:mono_field_from_token"></a> <a href="#api:mono_field_get_flags"></a> const char* <a href="#api:mono_field_get_name">mono_field_get_name</a> (MonoClassField *field); MonoClass* <a href="#api:mono_field_get_parent">mono_field_get_parent</a> (MonoClassField *field); MonoType* <a href="#api:mono_field_get_type">mono_field_get_type</a> (MonoClassField *field); void <a href="#api:mono_field_get_value">mono_field_get_value</a> (MonoObject *obj, MonoClassField *field, void *value); MonoObject* <a href="#api:mono_field_get_value_object">mono_field_get_value_object</a> (MonoDomain *domain, MonoClassField *field, MonoObject *obj); void <a href="#api:mono_field_set_value">mono_field_set_value</a> (MonoObject *obj, MonoClassField *field, void *value); void <a href="#api:mono_field_static_get_value">mono_field_static_get_value</a> (MonoVTable *vt, MonoClassField *field, void *value); void <a href="#api:mono_field_static_set_value">mono_field_static_set_value</a> (MonoVTable *vt, MonoClassField *field, void *value); guint32 <a href="#api:mono_property_get_flags">mono_property_get_flags</a> (MonoProperty *prop); MonoMethod* <a href="#api:mono_property_get_get_method">mono_property_get_get_method</a> (MonoProperty *prop); <a href="#api:mono_property_get_name"></a> MonoClass* <a href="#api:mono_property_get_parent">mono_property_get_parent</a> (MonoProperty *prop); MonoMethod* <a href="#api:mono_property_get_set_method">mono_property_get_set_method</a> (MonoProperty *prop); MonoObject* <a href="#api:mono_property_get_value">mono_property_get_value</a> (MonoProperty *prop, void *obj, void **params, MonoObject **exc); void <a href="#api:mono_property_set_value">mono_property_set_value</a> (MonoProperty *prop, void *obj, void **params, MonoObject **exc); MonoMethod* <a href="#api:mono_event_get_add_method">mono_event_get_add_method</a> (MonoEvent *event); guint32 <a href="#api:mono_event_get_flags">mono_event_get_flags</a> (MonoEvent *event); const char* <a href="#api:mono_event_get_name">mono_event_get_name</a> (MonoEvent *event); MonoClass* <a href="#api:mono_event_get_parent">mono_event_get_parent</a> (MonoEvent *event); MonoMethod* <a href="#api:mono_event_get_raise_method">mono_event_get_raise_method</a> (MonoEvent *event); MonoMethod* <a href="#api:mono_event_get_remove_method">mono_event_get_remove_method</a> (MonoEvent *event); void <a href="#api:mono_delegate_ctor">mono_delegate_ctor</a> (MonoObject *this, MonoObject *target, gpointer addr); MonoAsyncResult* <a href="#api:mono_async_result_new">mono_async_result_new</a> (MonoDomain *domain, HANDLE handle, MonoObject *state, gpointer data, MonoObject *object_data); gpointer <a href="#api:mono_load_remote_field">mono_load_remote_field</a> (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer *res); MonoObject* <a href="#api:mono_load_remote_field_new">mono_load_remote_field_new</a> (MonoObject *this, MonoClass *klass, MonoClassField *field); void <a href="#api:mono_store_remote_field">mono_store_remote_field</a> (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer val); void <a href="#api:mono_store_remote_field_new">mono_store_remote_field_new</a> (MonoObject *this, MonoClass *klass, MonoClassField *field, MonoObject *arg); MonoObject* <a href="#api:mono_nullable_box">mono_nullable_box</a> (guint8 *buf, MonoClass *klass); <a href="#api:mono_nullable_init"></a> </div> <p />MonoObject is the base definition for all managed objects in the Mono runtime, it represents the <a href="http://www.mono-project.com/monodoc/T:System.Object">System.Object</a> managed type. <p />All objects that derive from <a href="http://www.mono-project.com/monodoc/T:System.Object">System.Object</a> do have this base definition. Derived objects are declared following the pattern where the parent class is the first field of a structure definition, for example: <div class="code"> typedef struct { MonoObject parent; int my_new_field; } MyNewObject </div> <a name="objects"></a> <h2>Core Object Methods</h2> <a name="api:mono_object_new"></a> <div class="api"> <div class="api-entry">mono_object_new</div> <div class="prototype">MonoObject* mono_object_new (MonoDomain *domain, MonoClass *klass) </div> <p /> <b>Parameters</b> <blockquote><dt><i>klass:</i></dt><dd> the class of the object that we want to create</dd></blockquote> <b>Returns</b> <blockquote> a newly created object whose definition is looked up using <i>klass</i>. This will not invoke any constructors, so the consumer of this routine has to invoke any constructors on its own to initialize the object. <p /> It returns NULL on failure.</blockquote> <p />For example, if you wanted to create an object of type System.Version, you would use a piece of code like this: <div class="code"> MonoClass *version_class; MonoObject *result; /* Get the class from mscorlib */ version_class = mono_class_from_name (mono_get_corlib (), "System", "Version"); /* Create an object of that class */ result = mono_object_new (mono_domain_get (), version_class); </div> </div> <a name="api:mono_object_new_alloc_specific"></a> <div class="api"> <div class="api-entry">mono_object_new_alloc_specific</div> <div class="prototype">Prototype: mono_object_new_alloc_specific</div> <p /> </div> <a name="api:mono_object_new_fast"></a> <div class="api"> <div class="api-entry">mono_object_new_fast</div> <div class="prototype">Prototype: mono_object_new_fast</div> <p /> </div> <a name="api:mono_object_new_from_token"></a> <div class="api"> <div class="api-entry">mono_object_new_from_token</div> <div class="prototype">MonoObject* mono_object_new_from_token (MonoDomain *domain, MonoImage *image, guint32 token) </div> <p /> <b>Parameters</b> <blockquote><dt><i>image:</i></dt><dd> Context where the type_token is hosted</dd><dt><i>token:</i></dt><dd> a token of the type that we want to create</dd></blockquote> <b>Returns</b> <blockquote> A newly created object whose definition is looked up using <i>token</i> in the <i>image</i> image</blockquote> </div> <a name="api:mono_object_new_specific"></a> <div class="api"> <div class="api-entry">mono_object_new_specific</div> <div class="prototype">MonoObject* mono_object_new_specific (MonoVTable *vtable) </div> <p /> <b>Parameters</b> <blockquote><dt><i>vtable:</i></dt><dd> the vtable of the object that we want to create</dd></blockquote> <b>Returns</b> <blockquote> A newly created object with class and domain specified by <i>vtable</i></blockquote> </div> <a name="api:mono_object_clone"></a> <div class="api"> <div class="api-entry">mono_object_clone</div> <div class="prototype">MonoObject* mono_object_clone (MonoObject *obj) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> the object to clone</dd></blockquote> <b>Returns</b> <blockquote> A newly created object who is a shallow copy of <i>obj</i> </blockquote> </div> <a name="api:mono_object_get_class"></a> <div class="api"> <div class="api-entry">mono_object_get_class</div> <div class="prototype">MonoClass* mono_object_get_class (MonoObject *obj) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> object to query</dd></blockquote> <b>Returns</b> <blockquote> the MonOClass of the object. </blockquote> <b>Remarks</b> <p /> <p /> </div> <a name="api:mono_object_get_domain"></a> <div class="api"> <div class="api-entry">mono_object_get_domain</div> <div class="prototype">MonoDomain* mono_object_get_domain (MonoObject *obj) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> object to query</dd></blockquote> <b>Returns</b> <blockquote> the MonoDomain where the object is hosted </blockquote> <b>Remarks</b> <p /> <p /> </div> <a name="api:mono_object_get_virtual_method"></a> <div class="api"> <div class="api-entry">mono_object_get_virtual_method</div> <div class="prototype">MonoMethod* mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> object to operate on.</dd><dt><i>method:</i></dt><dd> method </dd></blockquote> <b>Remarks</b> <p /> Retrieves the MonoMethod that would be called on obj if obj is passed as the instance of a callvirt of method. </div> <a name="api:mono_object_isinst_mbyref"></a> <div class="api"> <div class="api-entry">mono_object_isinst_mbyref</div> <div class="prototype">Prototype: mono_object_isinst_mbyref</div> <p /> </div> <a name="api:mono_object_isinst"></a> <div class="api"> <div class="api-entry">mono_object_isinst</div> <div class="prototype">MonoObject* mono_object_isinst (MonoObject *obj, MonoClass *klass) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> an object</dd><dt><i>klass:</i></dt><dd> a pointer to a class </dd></blockquote> <b>Returns</b> <blockquote> <i>obj</i> if <i>obj</i> is derived from <i>klass</i> </blockquote> </div> <a name="api:mono_object_register_finalizer"></a> <div class="api"> <div class="api-entry">mono_object_register_finalizer</div> <div class="prototype">void mono_object_register_finalizer (MonoObject *obj) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> object to register</dd></blockquote> <b>Remarks</b> <p /> Records that object <i>obj</i> has a finalizer, this will call the Finalize method when the garbage collector disposes the object. <p /> </div> <a name="api:mono_object_unbox"></a> <div class="api"> <div class="api-entry">mono_object_unbox</div> <div class="prototype">gpointer mono_object_unbox (MonoObject *obj) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> object to unbox</dd></blockquote> <b>Returns</b> <blockquote> a pointer to the start of the valuetype boxed in this object. This method will assert if the object passed is not a valuetype.</blockquote> <b>Remarks</b> <p /> <p /> </div> <a name="api:mono_object_castclass_mbyref"></a> <div class="api"> <div class="api-entry">mono_object_castclass_mbyref</div> <div class="prototype">MonoObject* mono_object_castclass_mbyref (MonoObject *obj, MonoClass *klass) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> an object</dd><dt><i>klass:</i></dt><dd> a pointer to a class </dd></blockquote> <b>Returns</b> <blockquote> <i>obj</i> if <i>obj</i> is derived from <i>klass</i>, throws an exception otherwise </blockquote> </div> <a name="api:mono_object_is_alive"></a> <div class="api"> <div class="api-entry">mono_object_is_alive</div> <div class="prototype">Prototype: mono_object_is_alive</div> <p /> </div> <a name="api:mono_object_get_size"></a> <div class="api"> <div class="api-entry">mono_object_get_size</div> <div class="prototype">guint mono_object_get_size (MonoObject* o) </div> <p /> <b>Parameters</b> <blockquote><dt><i>o:</i></dt><dd> object to query</dd></blockquote> <b>Returns</b> <blockquote> the size, in bytes, of <i>o</i> </blockquote> <b>Remarks</b> <p /> <p /> <a name="valuetypes"></a> </div><h2>Value Types</h2> <a name="api:mono_value_box"></a> <div class="api"> <div class="api-entry">mono_value_box</div> <div class="prototype">MonoObject* mono_value_box (MonoDomain *domain, MonoClass *class, gpointer value) </div> <p /> <b>Parameters</b> <blockquote><dt><i>class:</i></dt><dd> the class of the value</dd><dt><i>value:</i></dt><dd> a pointer to the unboxed data</dd></blockquote> <b>Returns</b> <blockquote> A newly created object which contains <i>value</i>. </blockquote> </div> <a name="api:mono_value_copy"></a> <div class="api"> <div class="api-entry">mono_value_copy</div> <div class="prototype">Prototype: mono_value_copy</div> <p /> </div> <a name="api:mono_value_copy_array"></a> <div class="api"> <div class="api-entry">mono_value_copy_array</div> <div class="prototype">Prototype: mono_value_copy_array</div> <p /> <a name="arrays"></a> </div><h2>Array Methods</h2> <p />Use the <tt>mono_array_new_*</tt> methods to create arrays of a given type. <p />For example, the following code creates an array with two elements of type <tt>System.Byte</tt>, and sets the values 0xca and 0xfe on it: <pre class="code"> MonoArray *CreateByteArray (MonoDomain *domain) { MonoArray *data; data = mono_array_new (domain, mono_get_byte_class (), 2); mono_array_set (data, guint8, 0, 0xca); mono_array_set (data, guint8, 0, 0xfe); return data; } </pre> <h3>Creating Arrays</h3> <a name="api:mono_array_new"></a> <div class="api"> <div class="api-entry">mono_array_new</div> <div class="prototype">MonoArray* mono_array_new (MonoDomain *domain, MonoClass *eclass, mono_array_size_t n) </div> <p /> <b>Parameters</b> <blockquote><dt><i>domain:</i></dt><dd> domain where the object is created</dd><dt><i>eclass:</i></dt><dd> element class</dd><dt><i>n:</i></dt><dd> number of array elements</dd></blockquote> <b>Remarks</b> <p /> This routine creates a new szarray with <i>n</i> elements of type <i>eclass</i>. </div> <a name="api:mono_array_new_full"></a> <div class="api"> <div class="api-entry">mono_array_new_full</div> <div class="prototype">MonoArray* mono_array_new_full (MonoDomain *domain, MonoClass *array_class, mono_array_size_t *lengths, mono_array_size_t *lower_bounds) </div> <p /> <b>Parameters</b> <blockquote><dt><i>domain:</i></dt><dd> domain where the object is created</dd><dt><i>array_class:</i></dt><dd> array class</dd><dt><i>lengths:</i></dt><dd> lengths for each dimension in the array</dd><dt><i>lower_bounds:</i></dt><dd> lower bounds for each dimension in the array (may be NULL)</dd></blockquote> <b>Remarks</b> <p /> This routine creates a new array objects with the given dimensions, lower bounds and type. </div> <a name="api:mono_array_new_specific"></a> <div class="api"> <div class="api-entry">mono_array_new_specific</div> <div class="prototype">MonoArray* mono_array_new_specific (MonoVTable *vtable, mono_array_size_t n) </div> <p /> <b>Parameters</b> <blockquote><dt><i>vtable:</i></dt><dd> a vtable in the appropriate domain for an initialized class</dd><dt><i>n:</i></dt><dd> number of array elements</dd></blockquote> <b>Remarks</b> <p /> This routine is a fast alternative to mono_array_new() for code which can be sure about the domain it operates in. </div> <a name="api:mono_array_class_get"></a> <div class="api"> <div class="api-entry">mono_array_class_get</div> <div class="prototype">MonoClass* mono_array_class_get (MonoClass *eclass, guint32 rank) </div> <p /> <b>Parameters</b> <blockquote><dt><i>element_class:</i></dt><dd> element class </dd><dt><i>rank:</i></dt><dd> the dimension of the array class</dd></blockquote> <b>Returns</b> <blockquote> a class object describing the array with element type <i>element_type</i> and dimension <i>rank</i>. </blockquote> </div> <a name="api:mono_array_clone_in_domain"></a> <div class="api"> <div class="api-entry">mono_array_clone_in_domain</div> <div class="prototype">MonoArray* mono_array_clone_in_domain (MonoDomain *domain, MonoArray *array) </div> <p /> <b>Parameters</b> <blockquote><dt><i>domain:</i></dt><dd> the domain in which the array will be cloned into</dd><dt><i>array:</i></dt><dd> the array to clone</dd></blockquote> <b>Remarks</b> <p /> This routine returns a copy of the array that is hosted on the specified MonoDomain. </div> <a name="api:mono_array_clone"></a> <div class="api"> <div class="api-entry">mono_array_clone</div> <div class="prototype">MonoArray* mono_array_clone (MonoArray *array) </div> <p /> <b>Parameters</b> <blockquote><dt><i>array:</i></dt><dd> the array to clone</dd></blockquote> <b>Returns</b> <blockquote> A newly created array who is a shallow copy of <i>array</i> </blockquote> </div> <a name="api:mono_array_full_copy"></a> <div class="api"> <div class="api-entry">mono_array_full_copy</div> <div class="prototype">void mono_array_full_copy (MonoArray *src, MonoArray *dest) </div> <p /> <b>Parameters</b> <blockquote><dt><i>src:</i></dt><dd> source array to copy</dd><dt><i>dest:</i></dt><dd> destination array</dd></blockquote> <b>Remarks</b> <p /> Copies the content of one array to another with exactly the same type and size. </div> <a name="api:mono_array_to_lparray"></a> <div class="api"> <div class="api-entry">mono_array_to_lparray</div> <div class="prototype">Prototype: mono_array_to_lparray</div> <p /> </div> <a name="api:mono_array_to_savearray"></a> <div class="api"> <div class="api-entry">mono_array_to_savearray</div> <div class="prototype">Prototype: mono_array_to_savearray</div> <p /> </div> <a name="api:mono_dup_array_type"></a> <div class="api"> <div class="api-entry">mono_dup_array_type</div> <div class="prototype">Prototype: mono_dup_array_type</div> <p /> </div><h3>Using Arrays</h3> <a name="api:mono_array_set"></a> <div class="api"> <div class="api-entry">mono_array_set</div> <div class="prototype">Prototype: mono_array_set</div> <p /> </div> <a name="api:mono_array_setref"></a> <div class="api"> <div class="api-entry">mono_array_setref</div> <div class="prototype">Prototype: mono_array_setref</div> <p /> </div> <a name="api:mono_array_length"></a> <div class="api"> <div class="api-entry">mono_array_length</div> <div class="prototype">Prototype: mono_array_length</div> <p /> </div> <a name="api:mono_array_addr"></a> <div class="api"> <div class="api-entry">mono_array_addr</div> <div class="prototype">Prototype: mono_array_addr</div> <p /> </div> <a name="api:mono_array_addr_with_size"></a> <div class="api"> <div class="api-entry">mono_array_addr_with_size</div> <div class="prototype">Prototype: mono_array_addr_with_size</div> <p /> </div> <a name="api:mono_array_get"></a> <div class="api"> <div class="api-entry">mono_array_get</div> <div class="prototype">Prototype: mono_array_get</div> <p /> </div> <a name="api:mono_array_element_size"></a> <div class="api"> <div class="api-entry">mono_array_element_size</div> <div class="prototype">gint32 mono_array_element_size (MonoClass *ac) </div> <p /> <b>Parameters</b> <blockquote><dt><i>ac:</i></dt><dd> pointer to a #MonoArrayClass</dd></blockquote> <b>Returns</b> <blockquote> the size of single array element. </blockquote> <a name="fields"></a> </div><h2>Fields</h2> <a name="api:mono_field_from_token"></a> <div class="api"> <div class="api-entry">mono_field_from_token</div> <div class="prototype">Prototype: mono_field_from_token</div> <p /> </div> <a name="api:mono_field_get_flags"></a> <div class="api"> <div class="api-entry">mono_field_get_flags</div> <div class="prototype">Prototype: mono_field_get_flags</div> <p /> </div> <a name="api:mono_field_get_name"></a> <div class="api"> <div class="api-entry">mono_field_get_name</div> <div class="prototype">const char* mono_field_get_name (MonoClassField *field) </div> <p /> <b>Parameters</b> <blockquote><dt><i>field:</i></dt><dd> the MonoClassField to act on</dd></blockquote> <b>Returns</b> <blockquote> the name of the field. </blockquote> </div> <a name="api:mono_field_get_parent"></a> <div class="api"> <div class="api-entry">mono_field_get_parent</div> <div class="prototype">MonoClass* mono_field_get_parent (MonoClassField *field) </div> <p /> <b>Parameters</b> <blockquote><dt><i>field:</i></dt><dd> the MonoClassField to act on</dd></blockquote> <b>Returns</b> <blockquote> MonoClass where the field was defined. </blockquote> </div> <a name="api:mono_field_get_type"></a> <div class="api"> <div class="api-entry">mono_field_get_type</div> <div class="prototype">MonoType* mono_field_get_type (MonoClassField *field) </div> <p /> <b>Parameters</b> <blockquote><dt><i>field:</i></dt><dd> the MonoClassField to act on</dd></blockquote> <b>Returns</b> <blockquote> MonoType of the field. </blockquote> </div> <a name="api:mono_field_get_value"></a> <div class="api"> <div class="api-entry">mono_field_get_value</div> <div class="prototype">void mono_field_get_value (MonoObject *obj, MonoClassField *field, void *value) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> Object instance</dd><dt><i>field:</i></dt><dd> MonoClassField describing the field to fetch information from</dd><dt><i>value:</i></dt><dd> pointer to the location where the value will be stored</dd></blockquote> <b>Remarks</b> <p /> Use this routine to get the value of the field <i>field</i> in the object passed. The pointer provided by value must be of the field type, for reference types this is a MonoObject*, for value types its the actual pointer to the value type. For example: int i; mono_field_get_value (obj, int_field, &i); </div> <a name="api:mono_field_get_value_object"></a> <div class="api"> <div class="api-entry">mono_field_get_value_object</div> <div class="prototype">MonoObject* mono_field_get_value_object (MonoDomain *domain, MonoClassField *field, MonoObject *obj) </div> <p /> <b>Parameters</b> <blockquote><dt><i>domain:</i></dt><dd> domain where the object will be created (if boxing)</dd><dt><i>field:</i></dt><dd> MonoClassField describing the field to fetch information from</dd><dt><i>obj:</i></dt><dd> The object instance for the field.</dd></blockquote> <b>Returns</b> <blockquote> a new MonoObject with the value from the given field. If the field represents a value type, the value is boxed. </blockquote> </div> <a name="api:mono_field_set_value"></a> <div class="api"> <div class="api-entry">mono_field_set_value</div> <div class="prototype">void mono_field_set_value (MonoObject *obj, MonoClassField *field, void *value) </div> <p /> <b>Parameters</b> <blockquote><dt><i>obj:</i></dt><dd> Instance object</dd><dt><i>field:</i></dt><dd> MonoClassField describing the field to set</dd><dt><i>value:</i></dt><dd> The value to be set</dd></blockquote> <b>Remarks</b> <p /> Sets the value of the field described by <i>field</i> in the object instance <i>obj</i> to the value passed in <i>value</i>. This method should only be used for instance fields. For static fields, use mono_field_static_set_value. The value must be on the native format of the field type. </div> <a name="api:mono_field_static_get_value"></a> <div class="api"> <div class="api-entry">mono_field_static_get_value</div> <div class="prototype">void mono_field_static_get_value (MonoVTable *vt, MonoClassField *field, void *value) </div> <p /> <b>Parameters</b> <blockquote><dt><i>vt:</i></dt><dd> vtable to the object</dd><dt><i>field:</i></dt><dd> MonoClassField describing the field to fetch information from</dd><dt><i>value:</i></dt><dd> where the value is returned</dd></blockquote> <b>Remarks</b> <p /> Use this routine to get the value of the static field <i>field</i> value. The pointer provided by value must be of the field type, for reference types this is a MonoObject*, for value types its the actual pointer to the value type. For example: int i; mono_field_static_get_value (vt, int_field, &i); </div> <a name="api:mono_field_static_set_value"></a> <div class="api"> <div class="api-entry">mono_field_static_set_value</div> <div class="prototype">void mono_field_static_set_value (MonoVTable *vt, MonoClassField *field, void *value) </div> <p /> <b>Parameters</b> <blockquote><dt><i>field:</i></dt><dd> MonoClassField describing the field to set</dd><dt><i>value:</i></dt><dd> The value to be set</dd></blockquote> <b>Remarks</b> <p /> Sets the value of the static field described by <i>field</i> to the value passed in <i>value</i>. The value must be on the native format of the field type. <a name="properties"></a> </div><h2>Properties</h2> <a name="api:mono_property_get_flags"></a> <div class="api"> <div class="api-entry">mono_property_get_flags</div> <div class="prototype">guint32 mono_property_get_flags (MonoProperty *prop) </div> <p /> <b>Parameters</b> <blockquote><dt><i>prop:</i></dt><dd> the MonoProperty to act on.</dd></blockquote> <b>Returns</b> <blockquote> the flags for the property. </blockquote> <b>Remarks</b> <p /> The metadata flags for a property are encoded using the PROPERTY_ATTRIBUTE_* constants. See the tabledefs.h file for details. </div> <a name="api:mono_property_get_get_method"></a> <div class="api"> <div class="api-entry">mono_property_get_get_method</div> <div class="prototype">MonoMethod* mono_property_get_get_method (MonoProperty *prop) </div> <p /> <b>Parameters</b> <blockquote><dt><i>prop:</i></dt><dd> the MonoProperty to act on.</dd></blockquote> <b>Returns</b> <blockquote> the setter method of the property (A MonoMethod) </blockquote> </div> <a name="api:mono_property_get_name"></a> <div class="api"> <div class="api-entry">mono_property_get_name</div> <div class="prototype">Prototype: mono_property_get_name</div> <p /> </div> <a name="api:mono_property_get_parent"></a> <div class="api"> <div class="api-entry">mono_property_get_parent</div> <div class="prototype">MonoClass* mono_property_get_parent (MonoProperty *prop) </div> <p /> <b>Parameters</b> <blockquote><dt><i>prop:</i></dt><dd> the MonoProperty to act on.</dd></blockquote> <b>Returns</b> <blockquote> the MonoClass where the property was defined. </blockquote> </div> <a name="api:mono_property_get_set_method"></a> <div class="api"> <div class="api-entry">mono_property_get_set_method</div> <div class="prototype">MonoMethod* mono_property_get_set_method (MonoProperty *prop) </div> <p /> <b>Parameters</b> <blockquote><dt><i>prop:</i></dt><dd> the MonoProperty to act on.</dd></blockquote> <b>Returns</b> <blockquote> the setter method of the property (A MonoMethod) </blockquote> </div> <a name="api:mono_property_get_value"></a> <div class="api"> <div class="api-entry">mono_property_get_value</div> <div class="prototype">MonoObject* mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc) </div> <p /> <b>Parameters</b> <blockquote><dt><i>prop:</i></dt><dd> MonoProperty to fetch</dd><dt><i>obj:</i></dt><dd> instance object on which to act</dd><dt><i>params:</i></dt><dd> parameters to pass to the propery</dd><dt><i>exc:</i></dt><dd> optional exception</dd></blockquote> <b>Returns</b> <blockquote> the value from invoking the get method on the property. </blockquote> <b>Remarks</b> <p /> Invokes the property's get method with the given arguments on the object instance obj (or NULL for static properties). <p /> You can pass NULL as the exc argument if you don't want to catch exceptions, otherwise, *exc will be set to the exception thrown, if any. if an exception is thrown, you can't use the MonoObject* result from the function. </div> <a name="api:mono_property_set_value"></a> <div class="api"> <div class="api-entry">mono_property_set_value</div> <div class="prototype">void mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc) </div> <p /> <b>Parameters</b> <blockquote><dt><i>prop:</i></dt><dd> MonoProperty to set</dd><dt><i>obj:</i></dt><dd> instance object on which to act</dd><dt><i>params:</i></dt><dd> parameters to pass to the propery</dd><dt><i>exc:</i></dt><dd> optional exception</dd></blockquote> <b>Remarks</b> <p /> Invokes the property's set method with the given arguments on the object instance obj (or NULL for static properties). <p /> You can pass NULL as the exc argument if you don't want to catch exceptions, otherwise, *exc will be set to the exception thrown, if any. if an exception is thrown, you can't use the MonoObject* result from the function. <a name="events"></a> </div><h2>Events</h2> <a name="api:mono_event_get_add_method"></a> <div class="api"> <div class="api-entry">mono_event_get_add_method</div> <div class="prototype">MonoMethod* mono_event_get_add_method (MonoEvent *event) </div> <p /> <b>Parameters</b> <blockquote><dt><i>event:</i></dt><dd> The MonoEvent to act on.</dd></blockquote> <b>Returns</b> <blockquote> the <i>add</i>' method for the event (a MonoMethod). </blockquote> </div> <a name="api:mono_event_get_flags"></a> <div class="api"> <div class="api-entry">mono_event_get_flags</div> <div class="prototype">guint32 mono_event_get_flags (MonoEvent *event) </div> <p /> <b>Parameters</b> <blockquote><dt><i>event:</i></dt><dd> the MonoEvent to act on.</dd></blockquote> <b>Returns</b> <blockquote> the flags for the event. </blockquote> <b>Remarks</b> <p /> The metadata flags for an event are encoded using the EVENT_* constants. See the tabledefs.h file for details. </div> <a name="api:mono_event_get_name"></a> <div class="api"> <div class="api-entry">mono_event_get_name</div> <div class="prototype">const char* mono_event_get_name (MonoEvent *event) </div> <p /> <b>Parameters</b> <blockquote><dt><i>event:</i></dt><dd> the MonoEvent to act on</dd></blockquote> <b>Returns</b> <blockquote> the name of the event. </blockquote> </div> <a name="api:mono_event_get_parent"></a> <div class="api"> <div class="api-entry">mono_event_get_parent</div> <div class="prototype">MonoClass* mono_event_get_parent (MonoEvent *event) </div> <p /> <b>Parameters</b> <blockquote><dt><i>event:</i></dt><dd> the MonoEvent to act on.</dd></blockquote> <b>Returns</b> <blockquote> the MonoClass where the event is defined. </blockquote> </div> <a name="api:mono_event_get_raise_method"></a> <div class="api"> <div class="api-entry">mono_event_get_raise_method</div> <div class="prototype">MonoMethod* mono_event_get_raise_method (MonoEvent *event) </div> <p /> <b>Parameters</b> <blockquote><dt><i>event:</i></dt><dd> The MonoEvent to act on.</dd></blockquote> <b>Returns</b> <blockquote> the <i>raise</i> method for the event (a MonoMethod). </blockquote> </div> <a name="api:mono_event_get_remove_method"></a> <div class="api"> <div class="api-entry">mono_event_get_remove_method</div> <div class="prototype">MonoMethod* mono_event_get_remove_method (MonoEvent *event) </div> <p /> <b>Parameters</b> <blockquote><dt><i>event:</i></dt><dd> The MonoEvent to act on.</dd></blockquote> <b>Returns</b> <blockquote> the <i>remove</i> method for the event (a MonoMethod). </blockquote> <a name="delegates"></a> </div><h2>Delegates</h2> <a name="api:mono_delegate_ctor"></a> <div class="api"> <div class="api-entry">mono_delegate_ctor</div> <div class="prototype">void mono_delegate_ctor (MonoObject *this, MonoObject *target, gpointer addr) </div> <p /> <b>Parameters</b> <blockquote><dt><i>this:</i></dt><dd> pointer to an uninitialized delegate object</dd><dt><i>target:</i></dt><dd> target object</dd><dt><i>addr:</i></dt><dd> pointer to native code</dd></blockquote> <b>Remarks</b> <p /> This is used to initialize a delegate. <a name="async"></a> </div><h2>AsyncResults</h2> <a name="api:mono_async_result_new"></a> <div class="api"> <div class="api-entry">mono_async_result_new</div> <div class="prototype">MonoAsyncResult* mono_async_result_new (MonoDomain *domain, HANDLE handle, MonoObject *state, gpointer data, MonoObject *object_data) </div> <p /> <b>Parameters</b> <blockquote><dt><i>domain:</i></dt><dd>domain where the object will be created.</dd><dt><i>handle:</i></dt><dd> wait handle.</dd><dt><i>state:</i></dt><dd> state to pass to AsyncResult</dd><dt><i>data:</i></dt><dd> C closure data.</dd></blockquote> <b>Remarks</b> <p /> Creates a new MonoAsyncResult (AsyncResult C# class) in the given domain. If the handle is not null, the handle is initialized to a MonOWaitHandle. <a name="remote"></a> </div><h2>Remote Fields</h2> <a name="api:mono_load_remote_field"></a> <div class="api"> <div class="api-entry">mono_load_remote_field</div> <div class="prototype">gpointer mono_load_remote_field (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer *res) </div> <p /> <b>Parameters</b> <blockquote><dt><i>this:</i></dt><dd> pointer to an object</dd><dt><i>klass:</i></dt><dd> klass of the object containing <i>field</i></dd><dt><i>field:</i></dt><dd> the field to load</dd><dt><i>res:</i></dt><dd> a storage to store the result</dd></blockquote> <b>Returns</b> <blockquote> an address pointing to the value of field. </blockquote> <b>Remarks</b> <p /> This method is called by the runtime on attempts to load fields of transparent proxy objects. <i>this</i> points to such TP, <i>klass</i> is the class of the object containing <i>field</i>. <i>res</i> is a storage location which can be used to store the result. </div> <a name="api:mono_load_remote_field_new"></a> <div class="api"> <div class="api-entry">mono_load_remote_field_new</div> <div class="prototype">MonoObject* mono_load_remote_field_new (MonoObject *this, MonoClass *klass, MonoClassField *field) </div> <p /> <b>Parameters</b> <blockquote><dt><i>this:</i></dt><dd> </dd><dt><i>klass:</i></dt><dd> </dd><dt><i>field:</i></dt><dd></dd></blockquote> <b>Remarks</b> <p /> Missing documentation. </div> <a name="api:mono_store_remote_field"></a> <div class="api"> <div class="api-entry">mono_store_remote_field</div> <div class="prototype">void mono_store_remote_field (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer val) </div> <p /> <b>Parameters</b> <blockquote><dt><i>this:</i></dt><dd> pointer to an object</dd><dt><i>klass:</i></dt><dd> klass of the object containing <i>field</i></dd><dt><i>field:</i></dt><dd> the field to load</dd><dt><i>val:</i></dt><dd> the value/object to store</dd></blockquote> <b>Remarks</b> <p /> This method is called by the runtime on attempts to store fields of transparent proxy objects. <i>this</i> points to such TP, <i>klass</i> is the class of the object containing <i>field</i>. <i>val</i> is the new value to store in <i>field</i>. </div> <a name="api:mono_store_remote_field_new"></a> <div class="api"> <div class="api-entry">mono_store_remote_field_new</div> <div class="prototype">void mono_store_remote_field_new (MonoObject *this, MonoClass *klass, MonoClassField *field, MonoObject *arg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>this:</i></dt><dd></dd><dt><i>klass:</i></dt><dd></dd><dt><i>field:</i></dt><dd></dd><dt><i>arg:</i></dt><dd></dd></blockquote> <b>Remarks</b> <p /> Missing documentation <a name="nullable"></a> </div><h2>Nullable Objects</h2> <p />These methods are used to manipulate objects of type System.Nullable<T> <a name="api:mono_nullable_box"></a> <div class="api"> <div class="api-entry">mono_nullable_box</div> <div class="prototype">MonoObject* mono_nullable_box (guint8 *buf, MonoClass *klass) </div> <p /> <b>Parameters</b> <blockquote><dt><i>buf:</i></dt><dd> The buffer representing the data to be boxed</dd><dt><i>klass:</i></dt><dd> the type to box it as.</dd></blockquote> <b>Remarks</b> <p /> Creates a boxed vtype or NULL from the Nullable structure pointed to by <i>buf</i>. </div></body> </html> </span>