I got the impression that in the C ++ / CLI method, if the class I used implements IDisposable, dispose will automatically invoke magic when the object goes out of scope. I recently came across some code that looks like this:
void SomeClass::SomeMethod()
{
DisposableObject^ myObject = nullptr;
try
{
}
finally
{
if (myObject != nullptr)
{
delete myObject;
}
}
}
. -, delete . -, ++ delete , ++/CLI, , , nullptr delete, - same ++/CLI ( , , , ).