Davit Karapetyan Davit Karapetyan - 3 months ago 10
C# Question

Can I call specific generation GC

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

Answer

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: