0

我有一个具有以下签名的函数

public static void raiseEventtoForm(string message, Color fc, Color bc, int messageType, 
    EventLogEntryType eventType = EventLogEntryType.Information, bool frmSQL = false)
    {
        if(eventType != EventLogEntryType.Information && !frmSQL)
            postEventLog(message, eventType);
        MessageEvent(message, fc, bc, frmSQL);
    }

但是当我尝试调用它并设置它时,我得到一个无效的参数传递,我尝试了以下方法。我究竟做错了什么?

ProgramEvents.raiseEventtoFrom("example", Color.Black, Color.White, frmSQL:true);
ProgramEvents.raiseEventtoFrom("example", Color.Black, Color.White, frmSQL:= true);

编辑:错误:没有重载需要 4 个参数

*这是 /facepalm 的情况,我错过了明显的

4

3 回答 3

4

您没有指定第四个必需参数:int messageType

于 2014-07-15T14:52:17.327 回答
3

int messafeType不是可选参数(没有默认设置),因此它不是有效的方法调用

于 2014-07-15T14:53:27.427 回答
2

您只能省略指定了默认值的参数。但是您留下messageType了没有任何默认值的参数,这就是您出错的原因。

于 2014-07-15T14:53:34.260 回答