Suppose I have the following code:
IntPtr newPtr = new IntPtr( oldPtr.ToInt32() + 12 );
Is there any way to make the process of increasing oldPtr more streamlined?
Anything I’m missing or I should know?
edited to clarify: my curiosity was in easing the process itself, I’m just trying to get in the world of unmanaged and it’s difficult enough without the need to cast everything.
Since Framework 4.0 you can use Add() and Substract() methods.
If you are developing under an older environment, implement this in your project:
And, in your example, call: