PdfPrep.com

A public class named Message has a method named SendMessage. The SendMessage() method is leaking memory.

A public class named Message has a method named SendMessage. The SendMessage() method is leaking memory.

A . Add a finally statement and implement the gc.collect() method.
B . Modify the Message class to use the IDisposable interface.
C . Remove the try…catch block and allow the errors to propagate.
D . Replace the try…catch block with a using statement.

Answer: A

Explanation:

Reference: https://docs.microsoft.com/en-us/dotnet/api/system.gc.collect?redirectedfrom=MSDN&view=netframework-4.7.2#System_GC_Collect

Exit mobile version