我需要执行以下操作,但出现上述错误
class PrioritizedEvent<DelegateType>
{
private ArrayList delegates;
public PrioritizedEvent()
{
this.delegates = new ArrayList();
}
public void AddDelegate(DelegateType d, int priority)
{
this.delegates.Add(new PrioritizedDelegate<DelegateType>((Delegate)d, priority));
this.delegates.Sort();
}
protected class PrioritizedDelegate<DelegateType> : IComparable
{
public Delegate d;
public int priority;
public PrioritizedDelegate(Delegate d, int priority)
{
this.d = d;
this.priority = priority;
}
}
}
我不能将 DelegateType D 强制转换为 Delegate