MSIL of System.Int32 and int will be same?

Possible Duplicate:
C#, int or Int32? Should I care?

Please any one let me know MSIL of System.Int32 and int will be same or different, If different then which one we should use.

Edit:

this won't compile

public  enum MyEnum : Int32
{
    AEnum = 0
}

but this will

public enum MyEnum : int
{
    AEnum = 0
}

int is an alias for System.Int32 , they are completely the same.

enums only take integral types as type, as this would be possible otherwise:

using Int32 = System.String;

public enum Something : Int32
{
}

This is according to C# spec, which states

enum-declaration:
[attributes] [enum-modifiers ] enum identifier [enum-base] enum-body [;]

where
enum-base:
":" integral-type

With integral type specified as:

integral-type:
sbyte
byte
short
ushort
int
uint
long
ulong
char

http://msdn.microsoft.com/en-us/library/5kzh1b5w(v=VS.100).aspx

Type: int
.NET Framework type: System.Int32


Both are same but int is language specification is the definitive source for C# syntax and usage

Int32 is an immutable value type that represents signed integers with values that range from negative 2,147,483,648 (which is represented by the Int32.MinValue constant) through positive 2,147,483,647 (which is represented by the Int32.MaxValue constant. From MSDN

链接地址: http://www.djcxy.com/p/21036.html

上一篇: int和Int32的优缺点

下一篇: System.Int32和int的MSIL是否一样?