编译器错误 CS1909
更新:2007 年 11 月
错误消息
DefaultValue 属性不适用于“type”类型的参数
使用不适用于此参数类型的 DefaultValue 属性时,会生成 CS1909。
示例
下面的示例生成 CS1909。
// CS1909.cs
// compile with: /target:library
using System.Runtime.InteropServices;
public interface ISomeInterface
{
void Test1([DefaultParameterValue(new int[] {1, 2})] int[] arr1); // CS1909
void Test2([DefaultParameterValue("Test String")] string s); // OK
}