public SerializationBenchmarks() { var builder = new SerializerBuilder(); builder.AddType <ClosedClass>(); _serializer = builder.Build(); _serializerOfT = _serializer.GetSerializerFor <ClosedClass>(); _openClass = new OpenClass { Boolean = true, Byte = 1, Sbyte = 2, Short = 3, Ushort = 4, Int = 5, Uint = 6, Long = 7, Ulong = 8, Float = 9, Double = 10, Decimal = 11, DateTime = DateTime.UtcNow, DateTimeOffset = DateTimeOffset.UtcNow, Guid = Guid.NewGuid(), String = "Test" }; _closedClass = new ClosedClass(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, Guid.NewGuid(), DateTime.UtcNow, DateTimeOffset.UtcNow, "Test", true); }
public DeserializationBenchmarks() { var builder = new SerializerBuilder(); builder.AddType <ClosedClass>(); _serializer = builder.Build(); _serializerOfT = _serializer.GetSerializerFor <ClosedClass>(); _guid = Guid.NewGuid(); _dateTime = DateTime.UtcNow; _dateTimeOffset = DateTimeOffset.UtcNow; var openClass = new OpenClass { Boolean = true, Byte = 1, Sbyte = 2, Short = 3, Ushort = 4, Int = 5, Uint = 6, Long = 7, Ulong = 8, Float = 9, Double = 10, Decimal = 11, DateTime = _dateTime, DateTimeOffset = _dateTimeOffset, Guid = _guid, String = "Test" }; _bytes = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(openClass); }