How do you make sure that the garbage collector is done running when you call GC.Collect()?
GC.Collect()
by calling GC.WaitForPendingFinalizers()
GC.WaitForPendingFinalizers()
You cannot. GC.Collect() is a blocking method, and will return only once the garbage collector is done running.
There is no way to find this out.
by calling GC.WaitForFullGCComplete()
GC.WaitForFullGCComplete()