更新:2007 年 11 月
错误消息
DefaultValue 属性的变量类型必须与参数类型匹配对
示例
下面的示例生成 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
} | |