I could need some help to get this compile. I just want to pass a class type (SuccessEventArgs
) as parameter for a generic class DebugEvent<TArgs> where TArgs : System.EventArgs
.But for some reason this would not work ..
namespace MyInterface
{
[Serializable]
public class SuccessEventArgs : System.EventArgs
{
public SuccessEventArgs(string data);
public byte[] GetData();
}
}
public class DebugEvent<TArgs> where TArgs : System.EventArgs
{
// ...
}
// ///////////////////////////////////////////////////////////////////////
public abstract class DebugEventHandler
{
protected DebugEvent<EventArgs> m_programmingSucceededEvent = null;
}
public class MyDebugEventHandler : DebugEventHandler
{
override public void InitializeEventHandler(int programmingSuccessCode, int breakepointReachedCode)
{
m_programmingSucceededEvent = new DebugEvent<SuccessEventArgs>(ref m_eventSignal, programmingSuccessCode, this);
}
}
The error message:
Cannot implicitly convert type 'DebugEvent<SuccessEventArgs>' to 'DebugEvent<System.EventArgs>'
Shouldn't that be possible?