是否有整数和的Int32什么区别吗

是否有整数和的Int32什么区别吗

本文介绍了VB.Net:是否有整数和的Int32什么区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VB.Net,有整数的Int32

In VB.Net, is there any difference between Integer and Int32?

如果是,请解释一下。

推荐答案

在功能上存在的类型之间没有什么区别整数 System.Int32的。在VB.Net 整数只是一个别名 System.Int32的键入。

Functionally there is no difference between the types Integer and System.Int32. In VB.Net Integer is just an alias for the System.Int32 type.

标识符的Int32 整数不完全平等的,但。 整数始终是一个别名 System.Int32的,由编译器的理解。 的Int32 虽然不是特别的套管的编译器和经过像任何其他类型的正常名称解析。因此,有可能为的Int32 绑定到不同的类型在某些情况下。这是非常罕见的,虽然,没有人应该被定义自己的的Int32 键入

The identifiers Int32 and Integer are not completely equal though. Integer is always an alias for System.Int32 and is understood by the compiler. Int32 though is not special cased in the compiler and goes through normal name resolution like any other type. So it's possible for Int32 to bind to a different type in certain cases. This is very rare though, no one should be defining their own Int32 type

下面是具体的摄制这表明差异

Here is a concrete repro which demonstrates the difference

Class Int32

End Class

Module Module1
    Sub Main()
        Dim local1 As Integer = Nothing
        Dim local2 As Int32 = Nothing
        local1 = local2 ' Error!!!
    End Sub
End Module

在这种情况下, LOCAL1 local2 实际上是不同的类型,因为的Int32 绑定到用户定义类型在 System.Int32的

In this case local1 and local2 are actually different types because Int32 binds to the user defined type over System.Int32

这篇关于VB.Net:是否有整数和的Int32什么区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 19:28