インターフェイスを実装するクラスが与えられた場合:
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 }
}
どうすればこれを行うことができますか?