I need to do something like the following but getting the above error
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;
}
}
}
I cannot caste the DelegateType D to Delegate