Skip to content

Commit 55dbe85

Browse files
Brent Schmaltzbrentschmaltz
Brent Schmaltz
authored andcommitted
replace MemoryStream.ToArray() with GetBuffer()
1 parent 44c65e9 commit 55dbe85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Microsoft.IdentityModel.Tokens/Json/JsonSerializerPrimitives.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public static JsonElement CreateJsonElement(IList<string> strings)
8989
writer.WriteEndArray();
9090
writer.Flush();
9191

92-
Utf8JsonReader reader = new(memoryStream.ToArray());
92+
Utf8JsonReader reader = new(memoryStream.GetBuffer().AsSpan(0, (int)memoryStream.Length));
9393

9494
#if NET6_0_OR_GREATER
9595
bool ret = JsonElement.TryParseValue(ref reader, out JsonElement? jsonElement);

0 commit comments

Comments
 (0)