Should I use int or Int32

前端 未结 30 2453
野性不改
野性不改 2020-11-22 11:52

In C#, int and Int32 are the same thing, but I\'ve read a number of times that int is preferred over Int32 with no reason

30条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 12:31

    According to the Immediate Window in Visual Studio 2012 Int32 is int, Int64 is long. Here is the output:

    sizeof(int)
    4
    sizeof(Int32)
    4
    sizeof(Int64)
    8
    Int32
    int
        base {System.ValueType}: System.ValueType
        MaxValue: 2147483647
        MinValue: -2147483648
    Int64
    long
        base {System.ValueType}: System.ValueType
        MaxValue: 9223372036854775807
        MinValue: -9223372036854775808
    int
    int
        base {System.ValueType}: System.ValueType
        MaxValue: 2147483647
        MinValue: -2147483648
    

提交回复
热议问题