[Mono-list] [Mono-dev] Embedded API: mono_array_element_size issue
robertj at gmx.net
Wed Oct 2 15:48:15 UTC 2013
On 02.10.2013 15:34, jonathan at mugginsoft.com wrote:
> I am vaguely confused by the usage of the MonoClass here and elsewhere.
> I have an object, monoArray, yet to query it I require a class reference.
> This sort of logic wouldn't generally apply in an OOP environment (certainly not in Obj-C).
> Generally, instances have a many to one relationship to their class.
This applies to Mono as well.
> In the above example do all byte arrays share a MonoClass or is the class merely a struct configured for that particular array instance?
They do. You could use a slightly different approach to create arrays
that is more orthogonal to the MonoObject creation APIs:
1) obtain the MonoClass of an array with mono_array_class_get
2) create an instance of this array class with mono_array_new_full
More information about the Mono-list