更新:2007 年 11 月
错误消息
固定大小的缓冲区字段只能是结构的成员。
如果您在 class 而不是 struct 中使用固定大小的缓冲区,将会出现此错误。若要解决此错误,请将 class 更改为 struct 或者将字段声明为普通数组。
示例
下面的示例生成 CS1642。
// CS1642.cs
// compile with: /unsafe /target:library
unsafe class C
{
   fixed int a[10];   // CS1642
}
unsafe struct D
{
    fixed int a[10];
}
unsafe class E
{
   public int[] a = null;
}