How do you make sure that the garbage collector is done running when you call GC.Collect()?
GC.Collect()
There is no way to find this out.
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.
by calling GC.WaitForFullGCComplete()
GC.WaitForFullGCComplete()