此代码编译成功,但在执行期间会在 Visual Studio 2013 中导致 System.OverflowException:
Sub Main()
Dim a As ULong = 14345389830683080345D
Dim c As ULong = 1
Dim x As ULong = a And 1 '<-- cause System.OverflowException
Dim y As ULong = a And c '<-- works well
End Sub
你能解释一下为什么会这样吗?如果变量的值很小(例如 5),则不会发生异常。
PS变量的三个最高有效位全为零。