伪IT男
分类:
2008-11-30 15:05:09
'System.Threading.WaitHandle.Handle' is obsolete: 'Use the SafeWaitHandle property instead.'
And the source code related to this warning is:
wo.hEvent = writeEvent.Handle;
Then, I change it to:
wo.hEvent = writeEvent.SafeWaitHandle;
However, when I try building again, some error shows:
Cannot implicitly convert type 'Microsoft.Win32.SafeHandles.SafeWaitHandle' to 'System.IntPtr'
You can use the method. So your code will look like this:
wo.hEvent = writeEvent.SafeWaitHandle.DangerousGetHandle(); |
If you want to know why, please read this blog from Brian Grunkemeyer: SafeHandle: A Reliability Case Study.