给定一个实现接口的类:
public interface DomainEventSubscriber<T>
{
void HandleEvent(T domainEvent);
}
public class TestEventHandler : DomainEventSubscriber<TestEvent1>, DomainEventSubscriber<OtherTestEvent1>
{
public void HandleEvent(TestEvent1 domainEvent)
{
}
public void HandleEvent(OtherTestEvent1 domainEvent)
{
throw new NotImplementedException();
}
}
我想返回已实现的类型,即
static Type[] FindTypesForDomainEventSubscriberOfT(Type type)
{
// given a TestEventHandler type, I should return a collection of { TestEvent1, OtherTestEvent1 }
}
请问这怎么做?