Hi, The type has a FixedBufferAttribute custom attribute which contains the length of the array. There are some functions in reflection.c like mono_custom_attrs_from_class () which can return information about it.
Zoltan On Thu, Aug 6, 2015 at 12:32 PM, Bill Seurer <seu...@linux.vnet.ibm.com> wrote: > In some code in mono/mini I need to figure out how many elements there are > in a fixed buffer field in a struct, something like this: > > public unsafe struct double_array4 { > public fixed double f1[4]; > } > > So I'd need to know "4". > > I can get the MonoClass of the field from the MonoFieldType and if I print > out the name I get > > Test_double.double_array4.<f1>__FixedBuffer0 > > so it knows it is a fixed buffer. If I look at the fields of the struct > in the above example there is just one and it's a double. > > So how can I figure out the number of elements? > > Thanks! > -- > > -Bill Seurer > > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list >
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list