Which garbage collector method should you use?

You are developing an application by using C#.

The application includes an object that performs a long running process.

You need to ensure that the garbage collector does not release the object’s resources until the process completes.

Which garbage collector method should you use?
A . RemoveMemoryPressure()
B . ReRegisterForFinalize()
C . WaitForFullGCComplete()
D . KeepAlive()

Answer: D

Explanation:

The purpose of the KeepAlive method is to ensure the existence of a reference to an object that is at risk of being prematurely reclaimed by the garbage collector.

Reference: GC.KeepAlive Method (Object)

https://msdn.microsoft.com/en-us/library/system.gc.keepalive(v=vs.110).aspx

Latest 70-483 Dumps Valid Version with 288 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments