Fix violation in System.Private.DataContractSerialization (#48274)
authorNewell Clark <newellofthefuture@gmail.com>
Mon, 15 Feb 2021 03:47:52 +0000 (22:47 -0500)
committerGitHub <noreply@github.com>
Mon, 15 Feb 2021 03:47:52 +0000 (22:47 -0500)
- Prefer 'AsSpan' over 'Substring' when span-based overloads are available.

src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs

index 008658e..7d667cf 100644 (file)
@@ -1550,7 +1550,7 @@ namespace System.Runtime.Serialization
                 if (endIndex < 0)
                 {
                     if (localName != null)
-                        localName.Append(typeName.Substring(startIndex));
+                        localName.Append(typeName.AsSpan(startIndex));
                     nestedParamCounts.Add(0);
                     break;
                 }