Updated: July 2008
Returns the status of a registered notification for determining whether a full garbage collection by the common language runtime has completed.
Assembly: mscorlib (in mscorlib.dll)
'Declaration <PermissionSetAttribute(SecurityAction.LinkDemand, Name := "FullTrust")> _ Public Shared Function WaitForFullGCComplete As GCNotificationStatus 'Usage Dim returnValue As GCNotificationStatus returnValue = GC.WaitForFullGCComplete()
Return ValueType: System.GCNotificationStatus
The status of the registered garbage collection notification.
Use the GCNotificationStatus enumeration returned by this method to determine the status of the current garbage collection notification that was registered by using the RegisterForFullGCNotification method. You can also use the WaitForFullGCApproach method to determine whether a full garbage collection is imminent.
This method waits indefinitely for a garbage collection notification to be obtained. If you want to specify a time-out period for the method to return if the notification cannot be obtained, use the GC.WaitForFullGCApproach(Int32) method overload. If you call this method without specifying a time-out, you can call the CancelFullGCNotification method if you are waiting longer than preferred.
This method call should be preceded with a call to the WaitForFullGCApproach method to make sure that you have had a full garbage collection. Calling this method alone can produce indeterminate results.
The following example shows how to use this method to determine whether a full garbage collection has completed. Whenever the status of the notification is Succeeded, the user method OnFullGCCompletedNotify is called to perform actions in response to the completed collection. This code example is part of a larger example provided for Garbage Collection Notifications topic.
' Check for a notification of a completed collection. s = GC.WaitForFullGCComplete If (s = GCNotificationStatus.Succeeded) Then Console.WriteLine("GC Notifiction raised.") OnFullGCCompleteEndNotify() ElseIf (s = GCNotificationStatus.Canceled) Then Console.WriteLine("GC Notification cancelled.") Exit While Else ' Could be a time out. Console.WriteLine("GC Notification not applicable.") Exit While End If
for full trust for the immediate caller. This member cannot be used by partially trusted code.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.