Files
PipeMethodCallsDemo/PipeShared/JsonFieldsPipeSerializer.cs
Matthias Heil ae723b9bea Align client and solution with renamed projects
Update project references and solution entries to use
`PipeClient` and `PipeServer`, and launch the renamed
`PipeServer.exe` or `PipeServer.dll`.
2026-11-10 10:57:10 +01:00

17 lines
544 B
C#

using PipeMethodCalls;
using System.Text.Json;
namespace PipeShared;
/// <summary>
/// JSON serializer that also includes public fields (required for System.Numerics.Vector3).
/// </summary>
public class JsonFieldsPipeSerializer : IPipeSerializer
{
private static readonly JsonSerializerOptions Options = new() { IncludeFields = true };
public object Deserialize(byte[] data, Type type) => JsonSerializer.Deserialize(data, type, Options)!;
public byte[] Serialize(object o) => JsonSerializer.SerializeToUtf8Bytes(o, Options);
}