Share via


컴파일러 오류 CS1686

업데이트: 2007년 11월

오류 메시지

지역 'variable' 또는 해당 멤버의 주소를 가져와 무명 메서드 또는 람다 식 안에 사용할 수 없습니다.
Local 'variable' or its members cannot have their address taken and be used inside an anonymous method or lambda expression

이 오류는 변수를 사용하고 변수의 주소를 가져오려고 할 때 이러한 작업 중 하나가 무명 메서드 내에서 수행되는 경우에 발생합니다.

예제

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

// CS1686.cs
// compile with: /unsafe /target:library
class MyClass
{
   public unsafe delegate int * MyDelegate();

   public unsafe int * Test()
   {
      int j = 0;
      MyDelegate d = delegate { return &j; };   // CS1686
      return &j;   // OK
   }
}