I did some more digging, and found that arrays of enums are also
compatible with arrays of their underlying type. I really *love* this
(and I'm not being sarcastic), but I by my reading this is missing in
section 1.8.1. It *is* documented for the castclass instruction.
However, the C# compiler complains about casting an int[] to enum[]:
enum MyEnum : int { }
class Test {
public static void Main() {
// This isn't allowed:
//Func((MyEnum[])new int[1]);
// This is allowed:
Func((MyEnum[])(object)new int[1]);
}
public static void Func(MyEnum[] b) {}
}
And of course, this is also begs the question why castclass doesn't work
for casting a byte[] to an sbyte[].
Regards,
Jeroen