Is IntPtr.Zero equivalent to null?

后端 未结 3 1634
鱼传尺愫
鱼传尺愫 2020-12-05 09:41

I am trying to setup ReadFile to run asynchronously and according to MSDN, I need to set lpNumberOfBytesRead to null:

3条回答
  •  遥遥无期
    2020-12-05 09:56

    You cannot assign null to a value-type. A reference-type can be null, as in, not referring to an object instance, but a value-type always has a value.

    IntPtr.Zero is just a constant value that represents a null pointer.

提交回复
热议问题