I am sure there is a simple answer to this question that revolves around co-dispersion, but I try my best to see it!
I have a class like:
internal sealed class GenericCallbackClass<T> : SomeBaseClass where T : ICallbackMessageBase { public GenericCallbackClass(string activeId, T message) : base(activeId) { Message = message; } public T Message { get; private set; } }
Then I instantiate a class that implements ICallbackMessageBase called Foo and instantiate a new GenericCallbackClass, passing this as an argument to T for example var myCallback = new GenericCallback<Foo>("SomeID", new Foo())
Now I want to pass this to a more general instance of GenericCallbackClass, because I will have many examples of this with Foo, Bar, etc., but everyone implements ICallbackMessageBase.
So, I want to do something like var callback = myCallback as GenericCallbackClass<ICallbackMessageBase>
I can't seem to make this actor ... Any ideas how I can get around this?
source share