本帖最后由 xyz0835326 于 2013-08-14 13:31:02 编辑

解决方案 »

  1.   

    这里面包含了隐式转换,byte a = 1;
                    Int32 b = 1;
                    b = a;//可以
                    a = b;//错误
      

  2.   

    我们直接在vs中,把光标放到Equals方法上面,按F12。
    直接看一段里面的解释就知道Equals方法是比较什么的了。
      //
            // 摘要:
            //     Returns a value indicating whether this instance is equal to a specified
            //     System.Int32 value.
            //
            // 参数:
            //   obj:
            //     An System.Int32 value to compare to this instance.
            //
            // 返回结果:
            //     true if obj has the same value as this instance; otherwise, false.
            public bool Equals(int obj);
            //
            // 摘要:
            //     Returns a value indicating whether this instance is equal to a specified
            //     object.
            //
            // 参数:
            //   obj:
            //     An object to compare with this instance.
            //
            // 返回结果:
            //     true if obj is an instance of System.Int32 and equals the value of this instance;
            //     otherwise, false.
            public override bool Equals(object obj);
    另外,你执行以下: Console.WriteLine(a.Equals((byte)b)); 看看结果是什么。
      

  3.   

    理论上 Equals 对于引用类型比较的是引用的地址是否一样,对于值类型得了比较应该是比较值的大小是否相等。
    可能是clr做了一些动作吧。求解。
      

  4.   

    public bool Equals(int obj);
    戻り値:
            //     obj がこのインスタンスと同じ値を保持している場合は true。それ以外の場合は false。
    public bool Equals(byte obj);
    // 戻り値:
            //     obj がこのインスタンスに等しい場合は true。それ以外の場合は false。
    返回值的判定条件不同。(蛋疼,我是日文系统,顺道问下不改变操作系统语言的情况下,vs语言能变成英文么。)