On 01/07/03 Jeroen Frijters wrote: > > The underlying issue, though, is that with the > > Reflection.Emit API it's not possible to create enums as > > produced by csc. Once portable.net > > will implement Reflection.Emit, it'll have to support this > > stuff anyway, just like the MS runtime does. > > ... I would argue that MS's EnumBuilder.DefineLiteral is broken. It would be > best if it allowed both using the underlying type as well as the enum type, > but the current behavior as the only option is *not* acceptable (given that > it is not CLS compliant).
I don't know off-hand what DefineLiteral accepts. The issue is that you can't use EnumBuilder in all cases, so mcs doesn't use it and it 'constructs' the enum type by hand. The reason is that an API is missing (though it's documented): TypeBuilder.DefineNestedEnum(). So the process is to create a TypeBuilder and then DefineField() as needed. The value of the enum is set with FieldBuilder.SetConstant(). I think SetConstant() accepts values of the underlying type of the enum, but it can't accept constants of the type itself, because that would imply calling CreateType() on the enum type (and hence it wouldn't be possible anymore to create fields in it and set their value with SetConstant). lupus -- ----------------------------------------------------------------- [EMAIL PROTECTED] debian/rules [EMAIL PROTECTED] Monkeys do it better _______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
