How can I calculate the number of times that objects of a certain class (type?) Fall during the life of my application. Imagine that I have class A, now I want to calculate how many times objects A are assembled by GC.
I hope that I will formulate this right because I was asked about this in an interview today, and the answer I gave did not satisfy the interviewer. And that is what I think he was trying to ask.
I said that you can save a static field called count in class A and increase it in a call to Finalize () of this object.
The answer he expected was called a static block. I have never heard of this in .NET / C #. Can someone explain what this static block is?
source
share