日期:2014-05-18  浏览次数:20726 次

奇怪的问题,关于Int32,和int
I本人以为Int32是struct,int是整型,为啥还说这两种是一回事情呢??
类型都不一样嘛,虽然都是值类型。

------解决方案--------------------
C#源码
C# code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AboutInt
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 0;
            System.Int32 b = 0;
            int c = new int();
            System.Int32 d = new System.Int32();
        }
    }
}

------解决方案--------------------
Reflcetor也会"骗"你的眼睛的,要看这个问题还是要去到IL上看.

举个例子,就明白了:

有一段原始的C#代码:
C# code

        static void Main(string[] args)
        {
            int i = 0;
            Int32 j = 0;
            i = i + j;
        }

------解决方案--------------------
探讨

引用:

顺便问一下,你是怎么知道的?有官方文档之类的吗?还是只是猜测?


------解决方案--------------------
reflector反编译出来的int与C#程序中的int完全是两个东西