Reputation: 139
I have to two C# files:
EventDel.cs
:
public delegate void EventDel(DocdEvent event);
HBE.cs
which contains the next field:
public EventDel<ME> toCatchOne {get; set; }
It gives me the next error:
Delegate does not have type parameters.
How can I solve it?
Upvotes: 0
Views: 465
Reputation: 12954
EventDel
and EventDel<T>
are two entierly different types. They are not compatible. In your case EventDel
only accepts one parameter of type DocdEvent
. And the type EventDel<ME>
only accepts a parameter of type ME
(whatever that is).
To make your code work, try:
public EventDel<ME> toCatchOne {get; set; }
has to be converted into:
public EventDel toCatchOne {get; set; }
Or modify your first delegate:
public delegate void EventDel(DocdEvent event);
into:
public delegate void EventDel(ME event);
In the last case, you are still using two different type of delegates, but if you want to convert one delegate into another, use the constructor:
EventDel d1 = ...;
EventDel<ME> d2 = new EventDel<ME>(d1);
Upvotes: 0
Reputation: 28059
Your delegate does not appear to be generic, try this inside HBE.cs:
public EventDel toCatchOne {get; set; }
Or this inside EventDel.cs:
public delegate void EventDel<HBE>(DocdEvent event);
Upvotes: 1