.NET Interop IntPtr vs. ref

前端 未结 5 862
独厮守ぢ
独厮守ぢ 2020-12-28 09:22

Probably a noob question but interop isn\'t one of my strong points yet.

Aside from limiting the number of overloads is there any reason I should declare my DllImpo

5条回答
  •  伪装坚强ぢ
    2020-12-28 09:47

    I don't see any drawbacks.

    By-ref is often enough for simple type and simple structure.

    IntPtr should be favored if the structure has a variable-size or if you want to do custom processing.

提交回复
热议问题