<p/>The object API has methods for accessing <ahref="#fields">fields</a>, <ahref="#properties">properties</a>, <ahref="mono-api-methods.html">methods</a>, <ahref="#events">events</a>, <ahref="#delegates">delegates</a>.
<tableclass="mapi-parameters"><tbody><tr><td><i>klass</i></td><td> the class of the object that we want to create</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>vtable</i></td><td> virtual table for the object.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> This function allocates a new <code>MonoObject</code> with the type derived from the <i>vtable</i> information. If the class of this object has a finalizer, then the object will be tracked for finalization. <p/> This method might raise an exception on errors. Use the <code>mono_object_new_fast_checked</code> method if you want to manually raise the exception. <p/></div>
<tableclass="mapi-parameters"><tbody><tr><td><i>vtable</i></td><td> virtual table for the object.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div><p/> This function allocates a new <code>MonoObject</code> with the type derived from the <i>vtable</i> information. The returned object is not tracked for finalization. If your object implements a finalizer, you should use <code>mono_object_new_alloc_specific</code> instead. <p/> This method might raise an exception on errors. Use the <code>mono_object_new_fast_checked</code> method if you want to manually raise the exception. <p/></div>
<tableclass="mapi-parameters"><tbody><tr><td><i>image</i></td><td> Context where the type_token is hosted</td></tr><tr><td><i>token</i></td><td> a token of the type that we want to create</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>vtable</i></td><td> the vtable of the object that we want to create</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> A newly created object with class and domain specified
<tableclass="mapi-parameters"><tbody><tr><td><i>obj</i></td><td> the object to clone</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> A newly created object who is a shallow copy of <i>obj</i>
<tableclass="mapi-parameters"><tbody><tr><td><i>obj</i></td><td> object to operate on.</td></tr><tr><td><i>method</i></td><td> method </td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> Retrieves the <code>MonoMethod</code> that would be called on <i>obj</i> if <i>obj</i> is passed as the instance of a callvirt of <i>method</i>.</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>obj</i></td><td> an object</td></tr><tr><td><i>klass</i></td><td> a pointer to a class </td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div><i>obj</i> if <i>obj</i> is derived from <i>klass</i> or <code>NULL</code> otherwise.
<tableclass="mapi-parameters"><tbody><tr><td><i>obj</i></td><td> an object</td></tr><tr><td><i>klass</i></td><td> a pointer to a class </td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div><i>obj</i> if <i>obj</i> is derived from <i>klass</i>, returns <code>NULL</code> otherwise.
<tableclass="mapi-parameters"><tbody><tr><td><i>obj</i></td><td> The object</td></tr><tr><td><i>exc</i></td><td> Any exception thrown by <code>ToString</code>. May be <code>NULL</code>.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> the result of calling <code>ToString</code> on an object.
<tableclass="mapi-parameters"><tbody><tr><td><i>class</i></td><td> the class of the value</td></tr><tr><td><i>value</i></td><td> a pointer to the unboxed data</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> A newly created object which contains <i>value</i>.
<tableclass="mapi-parameters"><tbody><tr><td><i>dest</i></td><td> destination array</td></tr><tr><td><i>dest_idx</i></td><td> index in the <i>dest</i> array</td></tr><tr><td><i>src</i></td><td> source pointer</td></tr><tr><td><i>count</i></td><td> number of items</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> Copy <i>count</i> valuetype items from <i>src</i> to the array <i>dest</i> at index <i>dest_idx</i>. This function must be used when <i>klass</i> contains references fields. Overlap is handled.</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>domain</i></td><td> domain where the object is created</td></tr><tr><td><i>eclass</i></td><td> element class</td></tr><tr><td><i>n</i></td><td> number of array elements</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> This routine creates a new szarray with <i>n</i> elements of type <i>eclass</i>.</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>domain</i></td><td> domain where the object is created</td></tr><tr><td><i>array_class</i></td><td> array class</td></tr><tr><td><i>lengths</i></td><td> lengths for each dimension in the array</td></tr><tr><td><i>lower_bounds</i></td><td> lower bounds for each dimension in the array (may be <code>NULL</code>)</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> This routine creates a new array object with the given dimensions, lower bounds and type.</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>vtable</i></td><td> a vtable in the appropriate domain for an initialized class</td></tr><tr><td><i>n</i></td><td> number of array elements</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> This routine is a fast alternative to <code>mono_array_new</code> for code which can be sure about the domain it operates in.</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>element_class</i></td><td> element class </td></tr><tr><td><i>rank</i></td><td> the dimension of the array class</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> A class object describing the array with element type <i>element_type</i> and
<tableclass="mapi-parameters"><tbody><tr><td><i>array</i></td><td> the array to clone</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> A newly created array who is a shallow copy of <i>array</i>
<tableclass="mapi-parameters"><tbody><tr><td><i>array</i></td><td> array on which to operate on</td></tr><tr><td><i>element_type</i></td><td> C element type (example: <code>MonoString*</code>, <code>int</code>, <code>MonoObject*)</code></td></tr><tr><td><i>index</i></td><td> index into the array</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> The element at the <i>index</i> position in the <i>array</i>.
<div><p/> Use this macro to retrieve the <i>index</i> element of an <i>array</i> and extract the value assuming that the elements of the array match the provided type value. <p/> This method can be used with both arrays holding value types and reference types. For reference types, the <i>type</i> parameter should be a <code>MonoObject*</code> or any subclass of it, like <code>MonoString*</code>. <p/> This macro does not attempt to perform type checking or bounds checking. <p/></div>
<tableclass="mapi-parameters"><tbody><tr><td><i>array</i></td><td> a <code>MonoArray*</code></td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> the total number of elements in the array. This works for
<tableclass="mapi-parameters"><tbody><tr><td><i>array</i></td><td> array to alter</td></tr><tr><td><i>element_type</i></td><td> A C type name, this macro will use the sizeof(type) to determine the element size</td></tr><tr><td><i>index</i></td><td> index into the array</td></tr><tr><td><i>value</i></td><td> value to set</td></tr><tr><td><i>version</i></td><td> This sets the <i>index</i>'s element of the <i>array</i></td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> with elements of size sizeof(type) to the provided <i>value</i>. <p/> This macro does not attempt to perform type checking or bounds checking. <p/> Use this to set value types in a <code>MonoArray</code>.</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>array</i></td><td> array to alter</td></tr><tr><td><i>index</i></td><td> index into the array</td></tr><tr><td><i>value</i></td><td> value to set</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> Reference Type version. This sets the <i>index</i>'s element of the <i>array</i> with elements of size sizeof(type) to the provided <i>value</i>. <p/> This macro does not attempt to perform type checking or bounds checking. <p/> Use this to reference types in a <code>MonoArray</code>.</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>array</i></td><td> a <code>MonoArray*</code></td></tr><tr><td><i>size</i></td><td> size of the array elements</td></tr><tr><td><i>idx</i></td><td> index into the array</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> the address of the <i>idx</i> element in the array.
</div>
<divclass="mapi-section">Description</div>
<div> Use this function to obtain the address for the <i>idx</i> item on the <i>array</i> containing elements of size <i>size</i>. <p/> This method performs no bounds checking or type checking.</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>ac</i></td><td> pointer to a <code>MonoArrayClass</code></td></tr></tbody></table><divclass="mapi-section">Return value</div>
<divclass="mapi-entry mapi-strike"><code>mono_field_from_token</code></div><br/><divclass='mapi-deprecated'><b>Deprecated:</b> use the <code>_checked</code> variant</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>Notes</i></td><td> runtime code MUST not use this function</td></tr></tbody></table></div><!--mapi-description -->
<tableclass="mapi-parameters"><tbody><tr><td><i>field</i></td><td> the <code>MonoClassField</code> to act on</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>field</i></td><td> the <code>MonoClassField</code> to act on</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div><code>MonoClass</code> where the field was defined.
<tableclass="mapi-parameters"><tbody><tr><td><i>field</i></td><td> the <code>MonoClassField</code> to act on</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>obj</i></td><td> Object instance</td></tr><tr><td><i>field</i></td><td><code>MonoClassField</code> describing the field to fetch information from</td></tr><tr><td><i>value</i></td><td> pointer to the location where the value will be stored</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> Use this routine to get the value of the field <i>field</i> in the object passed. <p/> The pointer provided by value must be of the field type, for reference types this is a <code>MonoObject*</code>, for value types its the actual pointer to the value type. <p/> For example: <p/><pre> int i; <p/> mono_field_get_value (obj, int_field, &i); </pre></div>
<tableclass="mapi-parameters"><tbody><tr><td><i>domain</i></td><td> domain where the object will be created (if boxing)</td></tr><tr><td><i>field</i></td><td><code>MonoClassField</code> describing the field to fetch information from</td></tr><tr><td><i>obj</i></td><td> The object instance for the field.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> a new <code>MonoObject</code> with the value from the given field. If the
<tableclass="mapi-parameters"><tbody><tr><td><i>obj</i></td><td> Instance object</td></tr><tr><td><i>field</i></td><td><code>MonoClassField</code> describing the field to set</td></tr><tr><td><i>value</i></td><td> The value to be set</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div><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 <code>mono_field_static_set_value</code>. <p/> The value must be in the native format of the field type. </div>
<tableclass="mapi-parameters"><tbody><tr><td><i>vt</i></td><td> vtable to the object</td></tr><tr><td><i>field</i></td><td><code>MonoClassField</code> describing the field to fetch information from</td></tr><tr><td><i>value</i></td><td> where the value is returned</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> Use this routine to get the value of the static field <i>field</i> value. <p/> The pointer provided by value must be of the field type, for reference types this is a <code>MonoObject*</code>, for value types its the actual pointer to the value type. <p/> For example: <p/><pre> int i; <p/> mono_field_static_get_value (vt, int_field, &i); </pre></div>
<tableclass="mapi-parameters"><tbody><tr><td><i>field</i></td><td><code>MonoClassField</code> describing the field to set</td></tr><tr><td><i>value</i></td><td> The value to be set</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> Sets the value of the static field described by <i>field</i> to the value passed in <i>value</i>. The value must be in the native format of the field type. </div>
<tableclass="mapi-parameters"><tbody><tr><td><i>domain</i></td><td> an app domain</td></tr><tr><td><i>klass</i></td><td> a type</td></tr><tr><td><i>field</i></td><td> a field</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> A <code>System.Reflection.MonoField</code> object representing the field <i>field</i>
<tableclass="mapi-parameters"><tbody><tr><td><i>domain</i></td><td> an app domain</td></tr><tr><td><i>klass</i></td><td> a type</td></tr><tr><td><i>property</i></td><td> a property</td></tr><tr><td><i>error</i></td><td> set on error</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> a <code>System.Reflection.MonoProperty</code> object representing the property <i>property</i>
<tableclass="mapi-parameters"><tbody><tr><td><i>prop</i></td><td> the <code>MonoProperty</code> to act on.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div><p/> The metadata flags for a property are encoded using the <code>PROPERTY_ATTRIBUTE_*</code> constants. See the <code>tabledefs.h</code> file for details. <p/></div>
<tableclass="mapi-parameters"><tbody><tr><td><i>prop</i></td><td> the MonoProperty to act on.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> The getter method of the property (A <code>MonoMethod)</code>
<tableclass="mapi-parameters"><tbody><tr><td><i>prop</i></td><td> the <code>MonoProperty</code> to act on.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> The <code>MonoClass</code> where the property was defined.
<tableclass="mapi-parameters"><tbody><tr><td><i>prop</i></td><td> the <code>MonoProperty</code> to act on.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> The setter method of the property, a <code>MonoMethod</code>.
<tableclass="mapi-parameters"><tbody><tr><td><i>prop</i></td><td><code>MonoProperty</code> to fetch</td></tr><tr><td><i>obj</i></td><td> instance object on which to act</td></tr><tr><td><i>params</i></td><td> parameters to pass to the propery</td></tr><tr><td><i>exc</i></td><td> optional exception</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> the value from invoking the <code>get</code> method on the property.
<div> Invokes the property's <code>get</code> method with the given arguments on the object instance <i>obj</i> (or <code>NULL</code> for static properties). <p/> You can pass <code>NULL</code> as the <i>exc</i> argument if you don't want to catch exceptions, otherwise, <code>*exc</code> will be set to the exception thrown, if any. if an exception is thrown, you can't use the <code>MonoObject*</code> result from the function. <p/></div>
<tableclass="mapi-parameters"><tbody><tr><td><i>prop</i></td><td> MonoProperty to set</td></tr><tr><td><i>obj</i></td><td> instance object on which to act</td></tr><tr><td><i>params</i></td><td> parameters to pass to the propery</td></tr><tr><td><i>exc</i></td><td> optional exception</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> Invokes the property's set method with the given arguments on the object instance obj (or <code>NULL</code> for static properties). <p/> You can pass <code>NULL</code> as the exc argument if you don't want to catch exceptions, otherwise, <code>*exc</code> will be set to the exception thrown, if any. if an exception is thrown, you can't use the <code>MonoObject*</code> result from the function.</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>domain</i></td><td> an app domain</td></tr><tr><td><i>klass</i></td><td> a type</td></tr><tr><td><i>event</i></td><td> a event</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> A <code>System.Reflection.MonoEvent</code> object representing the event <i>event</i>
<tableclass="mapi-parameters"><tbody><tr><td><i>event</i></td><td> The <code>MonoEvent</code> to act on.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> The <code>add</code> method for the event, a <code>MonoMethod</code>.
<tableclass="mapi-parameters"><tbody><tr><td><i>event</i></td><td> the <code>MonoEvent</code> to act on.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div><p/> The metadata flags for an event are encoded using the <code>EVENT_*</code> constants. See the <code>tabledefs.h</code> file for details. <p/></div>
<tableclass="mapi-parameters"><tbody><tr><td><i>event</i></td><td> the MonoEvent to act on</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<tableclass="mapi-parameters"><tbody><tr><td><i>event</i></td><td> the MonoEvent to act on.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> The <code>MonoClass</code> where the event is defined.
<tableclass="mapi-parameters"><tbody><tr><td><i>event</i></td><td> The <code>MonoEvent</code> to act on.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> The <code>raise</code> method for the event, a <code>MonoMethod</code>.
<tableclass="mapi-parameters"><tbody><tr><td><i>event</i></td><td> The <code>MonoEvent</code> to act on.</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> The <code>remove</code> method for the event, a <code>MonoMethod</code>.
<tableclass="mapi-parameters"><tbody><tr><td><i>this</i></td><td> pointer to an object</td></tr><tr><td><i>klass</i></td><td> klass of the object containing <i>field</i></td></tr><tr><td><i>field</i></td><td> the field to load</td></tr><tr><td><i>res</i></td><td> a storage to store the result</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> 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>
<tableclass="mapi-parameters"><tbody><tr><td><i>this_obj</i></td><td> pointer to an object</td></tr><tr><td><i>klass</i></td><td> klass of the object containing <i>field</i></td></tr><tr><td><i>field</i></td><td> the field to load</td></tr><tr><td><i>val</i></td><td> the value/object to store</td></tr></tbody></table><divclass="mapi-section">Description</div>
<div> This method is called by the runtime on attempts to store fields of transparent proxy objects. <i>this_obj</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>
<tableclass="mapi-parameters"><tbody><tr><td><i>klass</i></td><td> The delegate class</td></tr></tbody></table><divclass="mapi-section">Return value</div>
<div> the <code>MonoMethod</code> for the <code>BeginInvoke</code> method in the delegate class or <code>NULL</code> if <i>klass</i> is a broken delegate type