Emitting Multi Dimentional Arrays
Given the following type defination:
This is what the C# compiler will output:
Notice the 0...,0... ? This means that this is a two dimentional array whose indexes starts with 0. The problem is that there is simply no way that I could find to generate an overload to this method from Reflection.Emit. Even when I pass it the correct Type (hard coded in C# to use int[,], for instnace), it still generates the following:
I am currently trying to read Boo's source code, but this is really looking for a needle in a haystack, and as far as I can see, Boo doesn't handle this at all.
Comments
Yes, I remember this one. I was in a course with my laptop trying to figure this one out. I gave up.... I can't remember this being an issue with .net 1.1
Yes, it was an issue on 1.1
I can't remember. Btw, another source for a solution (if one exists) is the Mono csc compiler.
You can use Mono.Cecil to emit exactly what you want.
What about the System.Array class, since that is what the int[0..,0..] is going to end up as anways?
Array.CreateInstance(), might do what you are looking for.
Nope, that still doesn't do it.
It won't respect the values that I give. it, unfortunately.
At one point I even hard coded typeof(int[,]), which should have worked, but it came out as int[,] instead of int[0...,0...]
Comment preview