public static IDisposable Pinned <T>(this T obj, out IntPtr ptr) where T : class { IDisposableAction ret = null; RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { var handle = GCHandle.Alloc(obj, GCHandleType.Pinned); ret = new FinalizerAction(() => handle.Free()); ptr = handle.AddrOfPinnedObject(); } return(ret); }
/// <inheritdoc /> public MicrosoftProxyRegister(IServiceCollection services) : base(services) { _disposableAction = new DisposableAction <IServiceCollection>(s => s.AddRegisterProxyFrom(this), services); }
/// <inheritdoc /> public AutofacProxyRegister(ContainerBuilder services) : base(services) { _disposableAction = new DisposableAction <ContainerBuilder>(s => s.RegisterProxyFrom(this), services); }
/// <inheritdoc /> public AspectCoreProxyRegister(IServiceContext services) : base(services) { _disposableAction = new DisposableAction <IServiceContext>(s => s.RegisterProxyFrom(this), services); }