Share via


컴파일러 오류 CS1706

업데이트: 2007년 11월

오류 메시지

식에는 무명 메서드 또는 람다 식을 사용할 수 없습니다.
Expression cannot contain anonymous methods or lambda expressions

무명 메서드는 식 안에 넣을 수 없습니다.

이 오류를 해결하려면

  • 일반적인 delegate를 식에서 사용하십시오.

예제

다음 예제에서는 CS1706 오류가 발생하는 경우를 보여 줍니다.

// CS1706.cs
using System;

delegate void MyDelegate();
class MyAttribute : Attribute
{
    public MyAttribute(MyDelegate d) { }
}

// Anonymous Method in Attribute declaration is not allowed.
[MyAttribute(delegate{/* anonymous Method in Attribute declaration */})]  // CS1706
class Program
{
}