Edit

Share via


Compiler Error CS1641

A fixed size buffer field must have the array size specifier after the field name

Unlike regular arrays, fixed size buffers require a constant size to be specified at the declaration point. To resolve this error, add a positive integer literal or a constant positive integer and put the square brackets after the identifier.

The following sample generates CS1641:

// CS1641.cs  
// compile with: /unsafe /target:library  
unsafe struct S {  
   fixed int [] a;  // CS1641  
  
   // OK  
   fixed int b [10];  
   const int c = 10;  
   fixed int d [c];  
}