Is it necessary to utilize the IntPtr constructor to set an IntPtr to equal another IntPtr?
问题 I am currently refactoring an application to 64 bit and I am trying to understand a specific use of the IntPtr. The code that I am trying to understand is in the form of: IntPtr a = Marshal.AllocHGlobal(SomeObjectSize); //SomeObjectSize is calculated based on some standard IntPtr b = IntPtr(a.ToInt32()); Now at first blush I figured I could just change a.ToInt32() to a.ToInt64() , which worked for instances where an int needed to go into an IntPtr , but since a and b are both IntPtr types,