Converting a nullable object to an integer





5.00/5 (4 votes)
Here is a slightly shorter version of your first conversion:object someValue = 1;int result = someValue as int? ?? -1;
Here is a slightly shorter version of your first conversion:
object someValue = 1;
int result = someValue as int? ?? -1;