Let's say I have the following class hierarchy: TaskViewer
inherits from ListViewer<Task>
which in turn inherits from ViewerBase
.
If I debug into a method that is declared in ViewerBase
and look at this.GetType()
, it correctly returns TaskViewer
. However, I cannot find a property or method which will return me the generic parameter that was used in the inheritance, i.e. Task
. Obviously if I was in the context of TaskViewer
or ListViewer<T>
then I would easily know this.
I can see that it was Task
by looking at the BaseType.FullName
property, but I've been through the list and nothing I can see identifies itself as having used that generic argument.
How might I get the original generic parameter from within this method in the root class?