diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifier.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifier.cs index 89afc4d625d1e9..1938972d79eac0 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifier.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifier.cs @@ -283,7 +283,7 @@ private static void EscapeKeywords(string identifier, StringBuilder sb) { if (separator >= 0) { - sb.Append(originalIdentifier.Substring(separator, 1)); + sb.Append(originalIdentifier[separator]); } separator++; separator += names[i].Length;