I'd like to use a default parameter value of IntPtr.Zero
in a function that takes an IntPtr
as an argument. This is not possible as IntPtr.Zero
is not a compile time constant.
Is there any way I can do what I want?
I'd like to use a default parameter value of IntPtr.Zero
in a function that takes an IntPtr
as an argument. This is not possible as IntPtr.Zero
is not a compile time constant.
Is there any way I can do what I want?
Since
IntPtr
is a struct, you could use Nullable-of-T?Somewhat unintuitive, to put it mildly, you get it by using the new operator:
That was for fun, you probably enjoy this one better: