[Mono-dev] Number of elements in a fixed buffer
Zoltan Varga
vargaz at gmail.com
Thu Aug 6 17:23:07 UTC 2015
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 <seurer at 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 at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20150806/5d8c2e3c/attachment-0001.html>
More information about the Mono-devel-list
mailing list