1

有关的:

假设 int 在 C# 中始终是 32 位是否安全?

链接的问题询问是否“假设 int 在 C# 中始终为 32 位是安全的”。接受的答案指出“C# 规范严格定义 int 是 System.Int32 的别名,正好是 32 位”。

我的问题是:这对 VB.Net 的 Integer 是否成立?假设 Integer 始终是 int32 的别名是否安全?

4

2 回答 2

7

是的。类型永远不会改变
Integer

规范(7.3 原始类型)说:

整数值类型 Byte(1 字节无符号整数)、Short(2 字节有符号整数)、Integer(4 字节有符号整数)和 Long(8 字节有符号整数)。这些类型分别映射到 System.Byte、System.Int16、System.Int32 和 System.Int64。整数类型的默认值等价于文字 0。

于 2011-07-01T13:29:00.270 回答
0

VB.Net 没有“int”,它有“Integer”类型。Integer 类型是 System.Int32 的别名。所以不,这不会改变。

于 2011-07-01T13:31:08.710 回答