C# addhandlers事件无方法重载接受0个参数
在我的windows phone c#应用程序中,我遇到了这个问题 我的代码:C# addhandlers事件无方法重载接受0个参数,c#,event-handling,windows-phone,C#,Event Handling,Windows Phone,在我的windows phone c#应用程序中,我遇到了这个问题 我的代码: public class mainclass { private void myfunc() { BinaryTransfer bn = new BinaryTransfer(params); bn.TransferProgress += OnEventProgress(); } priv
public class mainclass
{
private void myfunc()
{
BinaryTransfer bn = new BinaryTransfer(params);
bn.TransferProgress += OnEventProgress();
}
private void OnEventProgress(object sender, BinaryTransferProgress e)
{
Console.WriteLine("OK");
}
}
public class BinaryTransferProgress
{
public ulong Progress { get; set; }
public ulong Size { get; set; }
}
public class BinaryTransfer
{
...... CODE ....
public event EventHandler<BinaryTransferProgress> TransferProgress;
}
为什么?替换此:
bn.TransferProgress += OnEventProgress();
bn.TransferProgress += OnEventProgress;
为此:
bn.TransferProgress += OnEventProgress;