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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With