Let's say I have the following signature:
static extern void External(int foo, IntPtr bar);
I want to make it use defaults:
static extern void External(int foo = 10, IntPtr bar = default(IntPtr));
Is this valid? In C++, I would use the pointer to be 0 or null. In C#, it's not even clear if IntPtr is value or reference.
If I called my function manually, I would use External(10, IntPtr.Zero);
. I guess my question is: Will default(IntPtr)
have the same behavior as IntPtr.Zero
?