Home All Groups Group Topic Archive Search About

CLS compliance problem

Author
28 Aug 2006 11:38 PM
Lloyd Dupont
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!

Author
1 Sep 2006 8:05 PM
Ben Voigt
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!
>
Author
3 Sep 2006 10:15 PM
Lloyd Dupont
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!
>>
>
>

AddThis Social Bookmark Button