コード例 #1
0
        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);
        }
コード例 #2
0
 /// <inheritdoc />
 public MicrosoftProxyRegister(IServiceCollection services) : base(services)
 {
     _disposableAction = new DisposableAction <IServiceCollection>(s => s.AddRegisterProxyFrom(this), services);
 }
コード例 #3
0
 /// <inheritdoc />
 public AutofacProxyRegister(ContainerBuilder services) : base(services)
 {
     _disposableAction = new DisposableAction <ContainerBuilder>(s => s.RegisterProxyFrom(this), services);
 }
コード例 #4
0
 /// <inheritdoc />
 public AspectCoreProxyRegister(IServiceContext services) : base(services)
 {
     _disposableAction = new DisposableAction <IServiceContext>(s => s.RegisterProxyFrom(this), services);
 }