CLS Compliancy has different meaning between VB and C# ?

  • Thread starter Thread starter Jimi
  • Start date Start date
J

Jimi

How come a UInt32 parameter is CLS-compliant in VB, but not in C# ??

e.g.,
Public Sub TestCLS(ByRef x As UInt32)
is CLS-compliant (compiler doesn't complain when the CLSCompliant
attribute is set)

vs.

public void TestCLS(ref UInt32)
is not CLS-compliant (compiler complains when the CLSCompliant
attribute is set)

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
There is not a different meaning, VB.NET just doesn't call you on it.

As stated in the documentation for the CLSCompliantAttribute class:

Note The current Microsoft Visual Basic compiler intentionally does not
generate a CLS-compliance warning, however, a future release of the compiler
will issue that warning.
 
Back
Top