Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
You cannot call or override the Object.Finalize method from the C# or C++ programming languages. C# uses destructors as the mechanism for writing finalization code, as described in Destructors (C# Programming Guide).
In C++, destructor syntax is used to implement the Dispose method. C++ provides its own syntax for implementing the Finalize method, as described in Destructors and Finalizers in Visual C++.
Note |
|---|
Prior to version 2.0 of the .NET Framework, C++ used destructor syntax to implement the Finalize method, as C# does, and did not have special syntax for implementing the Dispose method. To compile C++ code that uses the earlier syntax, use the /clr:oldSyntax compiler option. |
Although they look similar, the C# and C++ destructors do not have the same semantics as unmanaged C++ destructors. Managed code does not support anything similar to C++ destructor semantics.
See Also
Reference
Object.Finalize Method
/clr (Common Language Runtime Compilation)
Concepts
Overriding the Finalize Method
Note