protected override T UnpackFromCore(Unpacker unpacker) { IMessagePackSerializer serializer; string typeName; // Read type name and packed object if (!(unpacker.ReadString(out typeName) && unpacker.Read())) { throw SerializationExceptions.NewUnexpectedEndOfStream(); } // Find matching serializer if (!_serializers.TryGetValue(typeName, out serializer)) { throw SerializationExceptions.NewTypeCannotDeserialize(typeof(T)); } // Unpack and return return((T)serializer.UnpackFrom(unpacker)); }