class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var s1 = new string("yyy");
var s2 = new string("yyy");
var s3 = new StringBuilder("yyy");
var s4 = new StringBuilder("yyy");
Console.WriteLine("object.ReferenceEquals(s1, s2): " + object.Equals(s1, s2));
Console.WriteLine("object.ReferenceEquals(s3, s4): " + object.Equals(s3, s4));
Console.WriteLine("s1 == s2: " + (s1.GetHashCode() + " " + s2.GetHashCode()));
Console.WriteLine("s1 == s2: " + (s1.GetHashCode() + " " + s2.GetHashCode()) + " " + s1.Equals(s2));
Console.WriteLine("s3 == s4: " + (s3.GetHashCode() + " " + s4.GetHashCode()) + " " + s3.Equals(s4));
AutoResetEvent autoResetEvent = new AutoResetEvent(false);
Console.ReadKey();
}
}
来源:oschina
链接:https://my.oschina.net/u/4352624/blog/3220597