/// <inheritdoc/> public override byte[] Serialize <T>(T value) { var serializer = _cache.GetSerializer(value.GetType()); var buffer = StringBuilderPool.Lease(); using (var stringWriter = new StringWriter(buffer)) { var writer = new SimpleJsonWriter(stringWriter); serializer.Serialize(value, writer); var bytes = Encoding.UTF8.GetBytes(buffer.ToString()); StringBuilderPool.Return(buffer); return(bytes); } }