Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 791 Bytes

cs1642.md

File metadata and controls

38 lines (31 loc) · 791 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Compiler Error CS1642
Compiler Error CS1642
07/20/2015
CS1642
CS1642
2efeedf1-1839-485d-8b8c-9045df1951f0

Compiler Error CS1642

Fixed size buffer fields may only be members of structs.

This error occurs if you use a fixed size buffer field in a class, instead of a struct. To resolve this error, change the class to a struct or declare the field as an ordinary array.

Example

The following sample generates 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;  
}