SafeHandle in F# January, 2010
The following is an implementation of a safe handle for a device info set:
It's extremely trivial to set this up that it's almost not worth blogging about but maybe someone can benefit from the example...
type DeviceInfoSetSafeHandle() = inherit SafeHandleMinusOneIsInvalid(true) [<DllImport("setupapi.dll")>] static extern bool SetupDiDestroyDeviceInfoList(IntPtr deviceInfoSet) override s.ReleaseHandle() = SetupDiDestroyDeviceInfoList(base.DangerousGetHandle())
It's extremely trivial to set this up that it's almost not worth blogging about but maybe someone can benefit from the example...