Davit Karapetyan Davit Karapetyan - 1 year ago 61
C# Question

Can I call specific generation GC

I'm interested if we can specifically call full GC or level 1 GC ?

Answer Source

You can specify the generation when calling Collect method

GC.Collect(1);

As Essigwurst wrote - remember about calling GC.WaitForPendingFinalizers() afterwards. Bare in mind that explicitly collecting is not reccomended because of permormance issues. You can get more information in these threads: