Sunday, March 29, 2015

How do destructors and garbage collection work in C#?

Question:How do destructors and garbage collection work in C#??

Answer: </P><P align=justify>C# has finalizers (similar to destructors except that the runtime doesn&#39;t guarantee they&#39;ll be called), and they are specified as follows: </P><P align=justify>class C</P><P align=justify>{</P><P align=justify>~C()</P><P align=justify>{</P><P align=justify>// your code</P><P align=justify>}</P><P align=justify>public static void Main() {}</P><P align=justify>}</P><P align=justify></P><P align=justify>Currently, they override object.Finalize(), which is called during the GC process.

Tags:Interview Questions, Microsoft, C#,

Please submit your Interview Answer for the above Question via replying to this post. Thank you for visiting to our blog, Have a Good Day!.



Sponsor Advertisement




Medical Billing Software

Hospital Management System Software

Hospital Management System (HMS) Software is developed for multispeciality hospitals, to cover a wide range of hospital administration and management processes with financial accounting, voucher entry, pharmacy, patients module etc features...

No comments:

Post a Comment