SafeWaitHandle property

Warning 4 'System.Threading.WaitHandle.Handle' is obsolete: 'Use the SafeWaitHandle property instead.'

It seems safewaithandle is used on .Net framework 2.0, however, I do not know how to change to safewaithandle. What is the name of the method Or which parts should I change

Source Code: if (checkSends)
wo.hEvent = writeEvent.Handle;

What should I do to writeEvent.Handle

Thanks!




Answer this question

SafeWaitHandle property

  • mackan100

    However, the error message will be shown if I try what you said:

    Error 1 Cannot implicitly convert type 'Microsoft.Win32.SafeHandles.SafeWaitHandle' to 'System.IntPtr'

    What's the meaning



  • Yaroslav

    You shouldn't use handles directly, you should use SafeWaitHandle-s instead. You can get the handle from the SafeWaitHandle using DangerousGetHandle, but if you do that, pretty much you're on your own.
  • Raja_Pols

    writeEvent.SafeWaitHandle
  • SafeWaitHandle property