Share via


컴파일러 오류 CS1908

업데이트: 2007년 11월

오류 메시지

DefaultValue 특성에 대한 인수 형식은 매개 변수 형식과 같아야 합니다.
The type of the argument to the DefaultValue attribute must match the parameter type

이 오류는 DefaultValueAttribute 특성 값에 잘못된 인수를 사용하는 경우에 발생합니다. 매개 변수 형식과 일치하는 값을 사용하십시오.

예제

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

// CS1908.cs
// compile with: /target:library
using System.Runtime.InteropServices;

public interface ISomeInterface
{
   void Bad([Optional] [DefaultParameterValue("true")] bool b);   // CS1908

   void Good([Optional] [DefaultParameterValue(true)] bool b);   // OK
}