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 . ReRegisterForFinalize()
B . SuppressFinalize()
C . Collect()
D . WaitForFullGCApproach()
Answer: B
Explanation:
You can use the SuppressFinalize method in a resource class to prevent a redundant garbage collection from being called.
Reference: GC.SuppressFinalize Method (Object)
https://msdn.microsoft.com/en-us/library/system.gc.suppressfinalize(v=vs.110).aspx