¿El tipo anulable no es un tipo anulable?
Estaba haciendo algunas pruebas con tipos anulables, y no funcionó como esperaba:
int? testInt = 0;
Type nullableType = typeof(int?);
Assert.AreEqual(nullableType, testInt.GetType()); // not the same type
Esto tampoco funciona:
DateTime? test = new DateTime(434523452345);
Assert.IsTrue(test.GetType() == typeof(Nullable)); //FAIL
DateTime? test = new DateTime(434523452345);
Assert.IsTrue(test.GetType() == typeof(Nullable<>)); //STILL FAIL
Mi pregunta es ¿por qué testInt.GetType () devuelve int y typeof (int?) Devuelve el verdadero tipo anulable?