I\'d like to have an integer variable which can be set to null and don\'t want to have to use the int? myVariable
syntax. I tried using int
and
The ?
syntax makes it nullable. If you dig a bit deeper, you'll see it's just a generic object that gets used.
If you want to do it like C++ you must use unsafe operations. Then, pointers like in C are available, but your code doesn't conform to CLR...
For using pure .NET without pointers, the ?
is the way to go.