public static string Intern(string str) { if (str == null) { throw new ArgumentNullException(nameof(str)); } return(InternTable.GetOrCreateValue(str)); }
public static string IsInterned(string str) { if (str == null) { throw new ArgumentNullException(nameof(str)); } string canonicalString; if (!InternTable.TryGetValue(str, out canonicalString)) { return(null); } return(canonicalString); }