static BinaryUtility() { var consoleLogger = new ConsoleLogger(); var serializationProviders = ProvidersUtils.GetDefaultProviders(consoleLogger); _uSerializer = new USerializer(new UnitySerializationPolicy(), serializationProviders, new DataTypesDatabase(), consoleLogger); }
public USerializerBenchmark() { var consoleLogger = new ConsoleLogger(); var serializationProviders = ProvidersUtils.GetDefaultProviders(consoleLogger); _uSerializer = new USerializer(new UnitySerializationPolicy(), serializationProviders, new DataTypesDatabase(), consoleLogger); _output = new SerializerOutput(2048 * 10); _input = new SerializerInput(2048 * 10); _uSerializer.PreCacheType(typeof(T)); if (_uSerializer.TryGetDataSerializer(typeof(T), out var dataSerializer)) { _serializer = dataSerializer.GetTyped <T>(); } else { throw new Exception($"Cannot serialize {typeof(T)}"); } }