public static void Main()
var hello2 = "He" + "llo";
var hello3 = new string(new char[] { 'H', 'e', 'l', 'l', 'o' });
Compare("hello1", hello1, "hello2", hello2);
Compare("hello1", hello1, "hello3", hello3);
var empty2 = string.Empty;
var empty3 = new string(new char[] { });
var empty4 = new string((char[])null);
Compare("empty1", empty1, "empty2", empty2);
Compare("empty1", empty1, "empty3", empty3);
Compare("empty1", empty1, "empty4", empty4);
private static void Info(string name, string value)
Console.WriteLine(name + ", IsInterned: " + string.IsInterned(value));
private static void Compare(string name1, string value1, string name2, string value2)
Console.WriteLine(name1 + " & " +name2 + ", Equals: " + value1.Equals(value2) + ", Reference Equals: " + Object.ReferenceEquals(value1,value2));