这很好用: Public Const test As ULong = 1 30 这不能很好地工作: Public Const test As ULong = 1 31 它会创建此错误: Constant expression not representable in type ‘ULong’ 我如何使其工作? 这确实有效: P
Public Const test As ULong = 1 << 30
这不能很好地工作:
Public Const test As ULong = 1 << 31
它会创建此错误:
Constant expression not representable in type ‘ULong’
我如何使其工作?
这确实有效:
Public Const test As Long = 1 << 31
但我必须使用ULong.
请尝试以下方法:Public Const test As ULong = 1UL << 31
您需要明确告诉编译器您正在对ULong进行操作.
C#等效工作:
public const ulong test = 1UL << 31;