Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error CS1642 

Error Message

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

Community Additions

ADD
Show:
© 2015 Microsoft