示例#1
0
文件: gc.cs 项目: wwkkww1983/ZJCredit
        private static GC.EndNoGCRegionStatus EndNoGCRegionWorker()
        {
            switch ((GC.EndNoGCRegionStatus)GC._EndNoGCRegion())
            {
            case GC.EndNoGCRegionStatus.NotInProgress:
                throw new InvalidOperationException("NoGCRegion mode must be set");

            case GC.EndNoGCRegionStatus.GCInduced:
                throw new InvalidOperationException("Garbage collection was induced in NoGCRegion mode");

            case GC.EndNoGCRegionStatus.AllocationExceeded:
                throw new InvalidOperationException("Allocated memory exceeds specified memory for NoGCRegion mode");

            default:
                return(GC.EndNoGCRegionStatus.Succeeded);
            }
        }
示例#2
0
 private static GC.EndNoGCRegionStatus EndNoGCRegionWorker()
 {
     GC.EndNoGCRegionStatus endNoGCRegionStatus = (GC.EndNoGCRegionStatus)GC._EndNoGCRegion();
     if (endNoGCRegionStatus == GC.EndNoGCRegionStatus.NotInProgress)
     {
         throw new InvalidOperationException("NoGCRegion mode must be set");
     }
     if (endNoGCRegionStatus == GC.EndNoGCRegionStatus.GCInduced)
     {
         throw new InvalidOperationException("Garbage collection was induced in NoGCRegion mode");
     }
     if (endNoGCRegionStatus == GC.EndNoGCRegionStatus.AllocationExceeded)
     {
         throw new InvalidOperationException("Allocated memory exceeds specified memory for NoGCRegion mode");
     }
     return(GC.EndNoGCRegionStatus.Succeeded);
 }