The problem being, the integer is not a user input.
I need to say:
if (id != null) {
}
It does not compile, I get the following:
Operator '!=' cannot be applied to operands of type 'int' and '<null>'
If I try
Convert.ToInt32(id)
It compiles but I get a runtime error:
System.NullReferenceException: Object reference not set to an instance of an object.
Any work around ?
I need to say:
if (id != null) {
}
It does not compile, I get the following:
Operator '!=' cannot be applied to operands of type 'int' and '<null>'
If I try
Convert.ToInt32(id)
It compiles but I get a runtime error:
System.NullReferenceException: Object reference not set to an instance of an object.
Any work around ?