It is possible to get an IntPtr from an int[] array?

后端 未结 2 498
孤城傲影
孤城傲影 2021-01-17 17:20

Greetings.

In C#: If I have an int[] array declared like this

int[] array = new array[size];

there is an way to get the IntPtr from

2条回答
  •  半阙折子戏
    2021-01-17 18:08

    Use unsafe code, like this:

    unsafe
    {
      fixed (int* pArray = array)
      {
        IntPtr intPtr = new IntPtr((void *) pArray);
      }
    }
    

提交回复
热议问题