更新:2007 年 11 月
错误消息
可能非有意的引用比较;若要获取值比较,请将左边强制转换为类型“type”
编译器正在进行引用比较。如果要比较字符串的值,请将表达式的左边转换为 type。
下面的示例生成 CS0252:
// CS0252.cs
// compile with: /W:2
using System;
class MyClass
{
   public static void Main()
   {
      string s = "11";
      object o = s + s;
      bool b = o == s;   // CS0252
      // try the following line instead
      // bool b = (string)o == s;
   }
}