[Mono-dev] Number of elements in a fixed buffer

Bill Seurer seurer at linux.vnet.ibm.com
Thu Aug 6 16:32:33 UTC 2015


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



More information about the Mono-devel-list mailing list