|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CLS compliance problemIn C++/CLI I defined an enum like that:
public enum class FontQuality : __int32 { Default = DEFAULT_QUALITY, Draft = DRAFT_QUALITY, Proof = PROOF_QUALITY, NonAntiAliased = NONANTIALIASED_QUALITY, AntiAliased = ANTIALIASED_QUALITY, ClearType = CLEARTYPE_QUALITY, ClearTypeNatural = CLEARTYPE_NATURAL_QUALITY }; Now I'm using it in C# library and the compiler warns me that it is not CLS compliant... Why is that? (and how to fix it?!) When I define a similar enum in C# I have no CLS compliance issue! You might have a look at the Microsoft one at
System.Windows.Forms.Internal.WindowsFontQuality. Compare the IL for all three versions with .NET Reflector. Also, try changing the __int32 base type to System.Int32, and put a CLSCompliant attribute on your assembly. Show quote "Lloyd Dupont" <net.galador@ld> wrote in message news:O9NtfsvyGHA.2036@TK2MSFTNGP05.phx.gbl... > In C++/CLI I defined an enum like that: > public enum class FontQuality : __int32 > { > Default = DEFAULT_QUALITY, > Draft = DRAFT_QUALITY, > Proof = PROOF_QUALITY, > NonAntiAliased = NONANTIALIASED_QUALITY, > AntiAliased = ANTIALIASED_QUALITY, > ClearType = CLEARTYPE_QUALITY, > ClearTypeNatural = CLEARTYPE_NATURAL_QUALITY > }; > > Now I'm using it in C# library and the compiler warns me that it is not > CLS > compliant... > > Why is that? (and how to fix it?!) > When I define a similar enum in C# I have no CLS compliance issue! > Thanks for the tips!! ;-)
Show quote "Ben Voigt" <rbv@nospam.nospam> wrote in message news:eKKp0HgzGHA.2516@TK2MSFTNGP06.phx.gbl... > You might have a look at the Microsoft one at > System.Windows.Forms.Internal.WindowsFontQuality. Compare the IL for all > three versions with .NET Reflector. > > Also, try changing the __int32 base type to System.Int32, and put a > CLSCompliant attribute on your assembly. > > > "Lloyd Dupont" <net.galador@ld> wrote in message > news:O9NtfsvyGHA.2036@TK2MSFTNGP05.phx.gbl... >> In C++/CLI I defined an enum like that: >> public enum class FontQuality : __int32 >> { >> Default = DEFAULT_QUALITY, >> Draft = DRAFT_QUALITY, >> Proof = PROOF_QUALITY, >> NonAntiAliased = NONANTIALIASED_QUALITY, >> AntiAliased = ANTIALIASED_QUALITY, >> ClearType = CLEARTYPE_QUALITY, >> ClearTypeNatural = CLEARTYPE_NATURAL_QUALITY >> }; >> >> Now I'm using it in C# library and the compiler warns me that it is not >> CLS >> compliant... >> >> Why is that? (and how to fix it?!) >> When I define a similar enum in C# I have no CLS compliance issue! >> > > |
|||||||||||||||||||||||