var a=new object();
var b=a;
Debug.Log(a==b);//True
Debug.Log(object.Equals(a,b));//True
Debug.Log(object.ReferenceEquals(a,b));//True
Debug.Log(1==1);//True
Debug.Log(object.Equals(1,1));//True
Debug.Log(object.ReferenceEquals(1,1));//False
var c=1;
var d=1;
Debug.Log(c==1);//True
Debug.Log(object.Equals(c,1));//True
Debug.Log(object.ReferenceEquals(c,1));//False
Debug.Log(object.ReferenceEquals(c,d));//False
var e="hello";
var f="hello";
Debug.Log(e==f);//True
Debug.Log(object.Equals(e,"hello"));//True
Debug.Log(object.Equals(e,f));//True
Debug.Log(object.ReferenceEquals(e,f));//True
var g=true;
var h=true;
Debug.Log(g==h);//True
Debug.Log(object.Equals(g,true));//True
Debug.Log(object.Equals(g,h));//True
Debug.Log(object.ReferenceEquals(g,h));//False
|
请发表评论