Arguments for CloseHandle() winapi call in .net?

It's really your choice, depending on how you obtain the handles. If the handles are originally embedded in some managed object, you should use HandleRef. If you got the handles from other PInvoke functions, and .

NET "knows" nothing about them, use IntPtr The advantage of HandleRef is that . NET promises to keep the container object alive as long as the HandleRef exists, but then marshals only the handle to the API function. In the specific case of CloseHandle, this doesn't really matter, so IntPtr should be fine.

It's really your choice, depending on how you obtain the handles. If the handles are originally embedded in some managed object, you should use HandleRef. If you got the handles from other PInvoke functions, and .

NET "knows" nothing about them, use IntPtr. The advantage of HandleRef is that . NET promises to keep the container object alive as long as the HandleRef exists, but then marshals only the handle to the API function.In the specific case of CloseHandle, this doesn't really matter, so IntPtr should be fine.

The HandleRef Structure documentation has a good explanation about its importance. It has to do with the proper functionality of the garbage collector.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions