Share via


컴파일러 오류 CS0636

업데이트: 2007년 11월

오류 메시지

FieldOffset 특성은 StructLayout(LayoutKind.Explicit)로 표시된 형식의 멤버에만 배치할 수 있습니다.
The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)

구조체에 FieldOffset 특성으로 표시된 멤버가 있으면 구조체 선언에 StructLayout(LayoutKind.Explicit) 특성을 사용해야 합니다. 자세한 내용은 FieldOffset을 참조하십시오.

다음 샘플에서는 CS0636 오류가 발생하는 경우를 보여 줍니다.

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

// To resolve the error, uncomment the following line:
// [StructLayout(LayoutKind.Explicit)]
struct Worksheet
{
   [FieldOffset(4)]public int i;   // CS0636 
}

public class MainClass
{
   public static void Main ()
   {
   }
}