I need to convert an UIntPtr
object to that of IntPtr
in my C# .NET 2.0 application. How can this be accomplished? I don't suppose it's as simple as this:
UIntPtr _myUIntPtr = /* Some initializer value. */
object _myObject = (object)_myUIntPtr;
IntPtr _myIntPtr = (IntPtr)_myObject;
This should work on x86 and x64
IntPtr intPtr = unchecked((IntPtr)(long)(ulong)uintPtr);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With