Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC#string interning and poolingSingle-choice MCQ

Two distinct String objects with equal content are passed to string.Intern separately. Considering how the intern pool and GC interact, which statement is correct?

string a = new string('x', 3); string b = new string('x', 3); string ia = string.Intern(a); string ib = string.Intern(b); bool same = ReferenceEquals(ia, ib);