I see others reference the method but If I include
System.GC.RunFinalizers()
I get the error 'System.GC' does not contain a definition for 'RunFinalizers'
System.GC.Collect();
runs fine. How can I run the method RunFinalizers? It doesn't seem to be a member of the GC class: http://msdn.microsoft.com/en-us/library/system.gc.aspx
Edit:
A reference to this method can be found here:
If you stick to standard coding in .NET, is there reason to manually invoke the GC or run finalizers?
This method has never been available in .Net BCL.
But it seems like this method was indeed available till .net 1.0 beta 2 and then removed from subsequent builds. It is very difficult to get any information regarding .net 1.0 beta versions but an inference (not foolproof though) can be drawn by looking at the following code:
Source: CodeForge
protected void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
ci=null;
System.GC.RunFinalizers();
Application.ExitThread();
Application.Exit();
}
The author of the above code is using this function.
Exes are included in the download (meaning thereby that the author was able to successfully build the application). Now the date of creation of source files and exes are Feb 2001 at which time only .Net Framework 1.0 beta 2 was available. So in all probability the author of the above code built it against .Net 1.0 beta2.
There is no public method named:
System.GC.RunFinalizers()
Any reference you read to it was most likely a confused reference to:
System.GC.WaitForPendingFinalizers()