共用方式為


編譯器錯誤 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
}