C# Error CS1641 – A fixed size buffer field must have the array size specifier after the field name

C# Error

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

Reason for the Error & Solution

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];  
}  

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...