Share via


Compiler Error CS1909

The DefaultValue attribute is not applicable on parameters of type 'type'

CS1909 is generated when you use a DefaultValue attribute that is not applicable on the parameter type.

Example

The following sample generates 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
}