c# - Finalize method in System.Object class -


Curiously I system. Separating mscorlib.dll to check the implementation of the object class.

I found something strange in it.

  1). Public class object {... protected override void finalize () {} ...}  

How is an override method in a base class?

  2) Public class employees {public zero instance mode () {this.Finalize ()); // Not compiled, can not I use the safe mode of the base class ?? }}  

I am wondering what is the use of the "preserved final form" method in the object class and why it got special treatment by the compiler?

Look at MSDN:

Destructors to run cleanup operations For C # mechanisms, destroyers provide proper security measures, such as the form of a type of killer called automatically, in the C # code, the object can not be called or overridden by phenyl.

Therefore, the answer to your question will be: Well - that's part of CLR's internal; For example, the C # compiler does all the work as required:

  public class employee {// finalizer, also known as "destroyer" ~ employee () {}}  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -