コード例 #1
0
        public virtual void Dispose()
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(GetType().FullName, "This object is already disposed!");
            }

            IsDisposed = true;

            DisposeCounter.Increment(GetType());
        }
コード例 #2
0
        public virtual void Dispose()
        {
            var type = GetType().GetTypeInfo();

            if (type.Namespace.StartsWith("Castle.Proxies"))
            {
                type = type.BaseType.GetTypeInfo();
            }

            if (IsDisposed)
            {
                throw new ObjectDisposedException(type.FullName, "This object is already disposed!");
            }

            IsDisposed = true;

            DisposeCounter.Increment(type.AsType());
        }