-1

So... I usually deal with the comfy managed code side of C#, but now I have to add finalizer for any class with unmanaged resource. I read about finalizer and IDisposable already, but I don't really know all the various numerous different ways to acquire and release unmanaged resource in C# so I don't know what to look for.

Is the GCHandle.Alloc and .Free pair the only one out there? What else is there?

ill mg
  • 331
  • 4
  • 8
  • If this is a real problem then you have a specific unm. resource. No need to look at all other forms of resources... – H H Oct 21 '11 at 09:37
  • First check: [do you really need it?](http://stackoverflow.com/q/3510513/60761) – H H Oct 21 '11 at 10:17

1 Answers1

2

The recommended way to handle unmanaged resources in C# is with the SafeHandle class

See also

Andrew Marshall
  • 1,469
  • 13
  • 14