Can someone explain to me why the below code outputs what it does? Why is T a String in the first one, not an Int32, and why is it the opposite case in the next output?
Method M inside B prints typeof(T) of A, A is parent class of B.
So irrespective of whether B is derived from whatever, M prints typeof(T) that is String.
So A prints nearest A's T.
So A will print string
Now, let us expand expression A, which is equivalent to A (since C is A), so method A will print nearest T.
A will print int