This documentation is archived and is not being maintained.

Compiler Error CS0637 

Error Message

The FieldOffset attribute is not allowed on static or const fields

The FieldOffset attribute cannot be used on fields marked with static or const.

The following sample generates CS0637:

// CS0637.cs
using System;
using System.Runtime.InteropServices;

public class MainClass
   [FieldOffset(3)]   // CS0637
   public static int i;
   public static void Main ()