I have the following generic class:
public class MessageProcesser<T> where T : Message
Inside the code I have the following attribute:
private readonly BlockingCollection<T> _messages;
When I try to do this I get an error (and as T is a Message it should be possible):
_messages.Add(new Message(MessageType.Stop));
What’s wrong?
Thanks!
You don’t have a collection of messages. Message can’t be T, because T may have been inherited.
try