Which one you want to use depends on the behavior your want. The first will throw an OverflowException
if the value of ContainerBaseAdress
does not fit in a 32-bit integer. This is likely to happen if the IntPtr points to some address and is being run on the 64-bit CLR. If throwing an exception is the desired behavior, then go with that.
The 2nd and 3rd are equivalent. The cast just wraps new
. However these will not throw an exception, they will just evaluate the false. Which of these you choose is a matter of stylistic preference.