In C# what is the difference between a destructor and a Finalize method in a class?
问题 What is the difference, if there is one, between a destructor and a Finalize method in a class? I recently discovered that Visual Studio 2008 considers a destructor synonymous with a Finalize method, meaning that Visual Studio won't let you simultaneously define both methods in a class. For example, the following code fragment: class TestFinalize { ~TestFinalize() { Finalize(); } public bool Finalize() { return true; } } Gives the following error on the call to Finalize in the destructor: The