Skip to content

Commit

Permalink
Return a MemoryStream for better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
nozzlegear committed Jan 3, 2025
1 parent 579430a commit 8a572b7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class SystemJsonSerializer(JsonSerializerOptions options) : IJsonSerial
private static SystemJsonElement Guard(IJsonElement element) =>
element as SystemJsonElement ?? throw new ArgumentException($"Expected a {nameof(SystemJsonElement)} but got {element.GetType().FullName}.", nameof(element));

private static Stream ToStream(IJsonElement value)
private static MemoryStream ToStream(IJsonElement value)
{
var element = Guard(value).GetRawObject();
var memoryStream = new MemoryStream();
Expand Down

0 comments on commit 8a572b7

Please sign in to comment.