public static void RegisterForFullGCNotification(int maxGenerationThreshold, int largeObjectHeapThreshold) { if (maxGenerationThreshold <= 0 || maxGenerationThreshold >= 100) { throw new ArgumentOutOfRangeException("maxGenerationThreshold", string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper"), (object)1, (object)99)); } if (largeObjectHeapThreshold <= 0 || largeObjectHeapThreshold >= 100) { throw new ArgumentOutOfRangeException("largeObjectHeapThreshold", string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper"), (object)1, (object)99)); } if (!GC._RegisterForFullGCNotification(maxGenerationThreshold, largeObjectHeapThreshold)) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotWithConcurrentGC")); } }