[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

GCHandle -- safe to Free during finalization?

Ted Miller

11/11/2003 11:20:00 PM

GCHandle is a struct, so I assume it's safe to clean one of these up during
a class finalization?

public class MyClass {

private GCHandle g;

//...

~MyClass()
{
g.Free(); // <---------- safe to do here?
}
}

(I know the code above is incomplete and that this should be part of a
larget Dispose pattern, etc. Code omitted for brevity.)