0

why object.ReferenceEquals(u, c)=false

class Program { static void Main(string[] args) { string a = "len"; string b = "len"; string c = new StringBuilder(a).ToString(); Console.WriteLine(c); Console.WriteLine(object.ReferenceEquals(a,c)); string u = string.Intern(c); Console.WriteLine(object.ReferenceEquals(u, c)); Console.ReadKey(); } }

26th Jul 2017, 8:55 AM
muhamad hardaniyan
muhamad hardaniyan - avatar
2 Respuestas
0
because they are different when you use string.intern
25th Jul 2017, 11:40 AM
Muhammed Faik Ekiciler
Muhammed Faik Ekiciler - avatar
0
but they have same value and interning says produce new string with this reference why c cant be reference in this satiation
25th Jul 2017, 12:08 PM
muhamad hardaniyan
muhamad hardaniyan - avatar