I once had a dev manager who loves puzzles and quizes. During our team meetings, he will write some code on the board and the team would have a competition to see who can spot the mistake first or who can answer a question about the code first. I always enjoyed those quiz. So I think I am going to start this on my blog. Once a month, I'll find something interesting and see who can give me the answer and an explaination why. 🙂 Of course you can just run the code and have the right answers, but understanding why is the interesting part.
Here is my first "Quiz of the month"! I'll post the answer to this in 2 weeks.
Without running it, can you tell me whether the code below will assert? If yes, why? If not, why not?
Type t1 = typeof(DerivedClass<>);
Type t2 = t1.BaseType;
string fullName1 = t1.FullName;
string fullName2 = t2.FullName;
Debug.Assert(fullName1 == fullName2);
public class BaseClass<T>
public class DerivedClass<T> : BaseClass<T>