public void GenerateLoad(IILGen ilGenerator, Action <IILGen> pushReader, Action <IILGen> pushCtx, Action <IILGen> pushDescriptor, Type targetType) { pushCtx(ilGenerator); ilGenerator.Callvirt(() => ((ITypeBinaryDeserializerContext)null).LoadEncryptedString()); if (targetType != typeof(object)) { if (targetType != GetPreferedType()) { throw new ArgumentOutOfRangeException(nameof(targetType)); } return; } ilGenerator.Box(GetPreferedType()); }
public void GenerateLoad(IILGen ilGenerator, Action <IILGen> pushReader, Action <IILGen> pushCtx, Action <IILGen> pushDescriptor, Type targetType) { pushReader(ilGenerator); ilGenerator.Call(_loader); if (targetType != typeof(object)) { if (targetType != GetPreferedType()) { throw new ArgumentOutOfRangeException(nameof(targetType)); } return; } if (GetPreferedType().IsValueType) { ilGenerator.Box(GetPreferedType()); } else { ilGenerator.Castclass(typeof(object)); } }
public void GenerateLoad(IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type targetType) { pushReader(ilGenerator); ilGenerator.Call(_loader); if (targetType != typeof(object)) { if (targetType != GetPreferedType()) throw new ArgumentOutOfRangeException(nameof(targetType)); return; } if (GetPreferedType().IsValueType) { ilGenerator.Box(GetPreferedType()); } else { ilGenerator.Castclass(typeof(object)); } }