Primitive type: Data Types directly supported by the compiler
The primitive types are directly mapped to the FCL class library. For example, int and Int32 are equivalent, except that int is provided by c # And Int32 is provided by the FCL class library.
Int is only the alias of Int32.
Using int = System. Int32;
Use Int32:
System. Int32 number = new System. Int32 ();
Number = 2;
Console. WriteLine (number );
Console. ReadKey ();
The generated IL code is:
static Main([] args) ] [mscorlib]System.Console::WriteLine(
Use int
Int number = new int ();
Number = 2;
Console. WriteLine (number );
Console. ReadKey ();
The generated IL code is:
static Main([] args) ] [mscorlib]System.Console::WriteLine(
By comparing the generated IL code, we found that the IL code generated by int and Int32 is the same.
The above number assignment syntax is inconvenient. I believe no one will. Fortunately, the compiler allows the code to manipulate them with simplified syntax,
Int number = 2; // C # simplified syntax
Int32 number = 2; // The simplified Syntax of FCL