Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to declare a variable with type int and null value in C#
How to declare a variable with type int and null value in C#
Ordinary int types are not allowed to be empty, but C# supports adding? Define a value type that can be empty, as follows:

int? A = empty;

//Check whether it is empty.

if (a.HasValue)

{

//Here a is not empty.

int b = a . Value

}

other

{

//Here a is empty.

}