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

Two string literals "abc" appearing in two different assemblies, plus a runtime-built string equal to "abc", are compared. Considering the CLR string intern pool, which statement is accurate about reference identity?

// Assembly1: string a = "abc"; // Assembly2: string b = "abc"; // runtime: string c = new string(new[]{'a','b','c'}); bool ab = ReferenceEquals(a, b); bool ac = ReferenceEquals(a, c); bool ac2 = ReferenceEquals(a, string.Intern(c));