This project is read-only.
Enums:

For several reasons, enums are not handled as regular C++ enums. First the variable size doesn't help, second we can't call functions, nor get the interface map from a C++ enum (interface map is needed during the boxing).

C# Code:

public enum TestEnumSByte : sbyte
{
    A,
    B,
    C
}


Generated C++ code:

BEGIN_DECLARE_ENUM(TestEnumSByte, ::System::SByte, 0)
    static const ::System::SByte A = 0;
    static const ::System::SByte B = 1;
    static const ::System::SByte C = 2;
END_DECLARE_ENUM


As you can see, enums are not type safe once converted (they are type safe during the .NET compilation though).
The macros BEGINDECLAREENUM and ENDDECLAREENUM are taking care of the class definition and various declarations (like the interface map).

Last edited Sep 7, 2007 at 8:51 PM by OlivierNallet, version 1

Comments

No comments yet.