Why does .ToString() on a null string cause a null error, when .ToString() works fine on a nullable int with null value?

Because string type’s null really points to nothing, there isn’t any object in memory.
But int? type(nullable) even with value set to null still points to some object.
If you read Jeffrey Richter’s “CLR via C#” you’ll find out that nullable type are just facade classes for common types with some incapsulated logics in order to make work with DB null more convenient.

Check msdn to learn about nullable types.

Leave a Comment