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()
by calling GC.WaitForFullGCComplete()
GC.WaitForFullGCComplete()
There is no way to find this out.
You cannot. GC.Collect() is a blocking method, and will return only once the garbage collector is done running.