The object API deals with all the operations shared by objects, value types, arrays.
The object API has methods for accessing fields, properties, methods, events, delegates.
There are some advanced uses that are useful to document here dealing with remote fields.
`MonoObject` is the base definition for all managed objects in the Mono runtime, it represents the System.Object managed type.
All objects that derive from System.Object 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:
For example, if you wanted to create an object of type System.Version, you would use a piece of code like this:
Use the mono_array_new_* methods to create arrays of a given type.
For example, the following code creates an array with two elements of type System.Byte, and sets the values 0xca and 0xfe on it:
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; }
Arrays are represented by the `MonoArray` data type and are instances of `MonoObject`. While you can use the `bounds` and `max_length` fields of the type, the actual storage (represented by `vector`) is not very useful. Instead you should use one of the accesor methods described below to fetch or set the values in the array.
When setting values in an array, you should use mono_array_set for setting elements in an array that contains value types, and mono_array_setref for arrays that contain reference types.
The mono_array_get, mono_array_set and mono_array_setref are C macros that wrap the underlying array access.