Why does this code call the Garbage Collector? Twice?

Coordinator
Mar 26, 2008 at 4:58 PM
Someone asked why the conversion code calls the Garbage Collector? And why twice?

This is what MSDN example code (link below) does.

http://msdn2.microsoft.com/en-us/library/bb412305.aspx

GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();

See section 5. "Implement the Conversion Code "

This section refers us to another article on "Basics of Office Interoperability " - link below.

http://msdn2.microsoft.com/en-us/library/aa679807.aspx