UInt32 in VB.NET

  • Thread starter Thread starter Shankar
  • Start date Start date
S

Shankar

Hi,

I am writing a Managed C++ class library where
interfaces take a unsigned int parameter. Looking at the
CTS documentation, it is mentioned that there is no built-
in type in VB.NET for this and System::UInt32 is to be
used. Now VB.NET does not even allow integer
literals/variables to be assigned to a UInt32 variabe.
Can somebody please explain the idea behind this and
what type should I use in interfaces ?

Thanks,
Shankar
 
Shankar said:
Hi,

I am writing a Managed C++ class library where
interfaces take a unsigned int parameter. Looking at the
CTS documentation, it is mentioned that there is no built-
in type in VB.NET for this and System::UInt32 is to be
used. Now VB.NET does not even allow integer
literals/variables to be assigned to a UInt32 variabe.
Can somebody please explain the idea behind this and
what type should I use in interfaces ?

If you want your interface to be CLS compliant and usable from VB.NET, you
must not use UInt32. However, I also wonder why UInt32 is not CLS compliant.
 
Hello,

Shankar said:
I am writing a Managed C++ class library where
interfaces take a unsigned int parameter. Looking at the
CTS documentation, it is mentioned that there is no built-
in type in VB.NET for this and System::UInt32 is to be
used. Now VB.NET does not even allow integer
literals/variables to be assigned to a UInt32 variabe.

Unsigned types are not CLS compliant. Don't use them in your interfaces.
 
Back
Top