C#中的不安全指针/数组表示法

xof*_*ofz 2 c# pointers

假设我有:

unsafe {
    byte* start = GetStartLocation();
    int something = start[4];
}
Run Code Online (Sandbox Code Playgroud)

什么是something?内存地址的值从开始减少4个字节?

Ric*_*dle 6

start指向内存位置0x12345678,内存如下所示:

  0x12345678   0x12
  0x12345679   0x34
  0x1234567a   0x56
  0x1234567b   0x78
  0x1234567c   0x9a
  0x1234567d   0xbc
Run Code Online (Sandbox Code Playgroud)

然后something等于0x9a.

something具有类型的事实int与如何start[4]解释无关- 它获取byte字节4位置的值start.