哪个大哥能给讲讲object类型~~
还有什么情况下相等
还有什么情况下相等
这个是MSDN上的例子:The example
using System; class Test { static void Main() { string s = "Test"; string t = string.Copy(s); Console.WriteLine(s == t); Console.WriteLine((object)s == (object)t); } }produces the outputTrue False
(object)s == (object)t,这个为什么不相等呢?
using System;
class Test
{
static void Main()
{
object s = "Test";
object t = "Test";
Console.WriteLine(s == t);
}
}
这个为什么相等呢?
using System;
class Test
{
static void Main()
{
object s = "Test";
object t = "Tst";
Console.WriteLine(s == t);
}
}
这个怎么又不等呢??
=====================================
初学C#见谅