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

Compile-time constant string concatenation behaves differently from runtime concatenation with respect to interning. What does the snippet print and why?

string a = "hello"; const string p = "hel"; string c = p + "lo"; Console.WriteLine(ReferenceEquals(a, c));