August 20, 2009
Tricky Question


1. static void Main(string[] args)
2.{
3.    object x = null;
4.    object y = (short)4;
5.    x = (y is System.Int32) ? (System.Int32)y : (System.Int16)y;
6.    Console.WriteLine(x.GetType());
7.}
What is printed out? Try it. Explain why you were wrong. Read here why. Really nice article.