I am using Mono and encountered an interesting result when comparing references of two strings. The code below demonstrates an example:
using System;
class Program
{
static void Main()
{
String s1 = "asd";
String s2 = "asd";
Console.WriteLine("Reference Equals: {0}", Object.ReferenceEquals(s1, s2));
Console.ReadLine();
}
}
Yields true.
It is interesting, two strings have same value but obviously they refer to two different instances. What is going on?
mono --version : Mono JIT compiler version 3.2.6 OS X 10.9.2