Compiler Error CS0637
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;
[StructLayout(LayoutKind.Explicit)]
public class MainClass
{
[FieldOffset(3)] // CS0637
public static int i;
public static void Main ()
{
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: