Intering string in C #
Consider the following code snippet in C #
string s = "hi"; object k="hi".Substring(0); // 1> k==s // true // 2> Object.ReferenceEquals(s,k) //true but when
Object k="hii".Substring(0,2); // 1> k==s // false // 2> Object.ReferenceEquals(s,k) //false I find it difficult to understand why in the first case the lines were interned, and in the second case this is not so. It would also be very helpful if anyone can specify the rules when string interning happens in C #.
+5
No one has answered this question yet.
See similar questions:
or similar: