private static bool StartNoGCRegionWorker(long totalSize, bool hasLohSize, long lohSize, bool disallowFullBlockingGC) { switch ((GC.StartNoGCRegionStatus)GC._StartNoGCRegion(totalSize, hasLohSize, lohSize, disallowFullBlockingGC)) { case GC.StartNoGCRegionStatus.AmountTooLarge: throw new ArgumentOutOfRangeException("totalSize", "totalSize is too large. For more information about setting the maximum size, see \"Latency Modes\" in http://go.microsoft.com/fwlink/?LinkId=522706"); case GC.StartNoGCRegionStatus.AlreadyInProgress: throw new InvalidOperationException("The NoGCRegion mode was already in progress"); case GC.StartNoGCRegionStatus.NotEnoughMemory: return(false); default: return(true); } }