Constant expression not representable in type 'UInteger'

If I run the following code in C # then it works fine

UInt32 a
a = 0x9E3779B9

But when I run the same code in VB.Net, it gives me the error "Constant expression not representable in type" UInteger ""

Dim a As UInt32
a = &H9E3779B9
+3
source share
2 answers

Just put the user interface at the end

a = &H9E3779B9UI

Mark this link

From MSDN

You can follow a prefix literal with a letter type character. The following example shows this.

Dim counter As Short = &H8000S
Dim flags As UShort = &H8000US
+5
source

I think you can solve your problem by looking at this link, see the "Workarounds" section in this link.

Just add “UI” to the end of the literal:

      Dim x as UInteger = &HF2894233UI

& H

+2

All Articles