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); } }
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); }