-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
  • 311
  • 4
  • 8

1 Answers1

2

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

See also

Andrew Marshall
  • 1,369
  • 10
  • 12